]> sourceware.org Git - systemtap.git/commitdiff
PR6925: tolerate modules left over from previous crashed? stap sessions
authorFrank Ch. Eigler <fche@elastic.org>
Wed, 3 Dec 2008 21:56:03 +0000 (16:56 -0500)
committerFrank Ch. Eigler <fche@elastic.org>
Wed, 3 Dec 2008 21:56:03 +0000 (16:56 -0500)
runtime/staprun/ChangeLog
runtime/staprun/staprun.c

index 35dd77196eb89a08e7cf107d7040fc2921a483e7..aff94da3a3fb6e1e950d32dcc771b5364242578d 100644 (file)
@@ -1,3 +1,9 @@
+2008-12-03  Frank Ch. Eigler  <fche@elastic.org>
+
+       PR6925
+       * staprun (init_staprun): If a stap_* module load fails, try
+       to unload possible leftover, and try again.
+
 2008-11-28  Frank Ch. Eigler  <fche@elastic.org>
 
        PR4783
index b6d7797934802ccb0182f69fe9e582301fac3ec4..9d647675cce6d24c5f02148c5934ebe620ed1d44 100644 (file)
@@ -136,6 +136,7 @@ static int enable_uprobes(void)
 static int insert_stap_module(void)
 {
        char bufsize_option[128];
+
        if (snprintf_chk(bufsize_option, 128, "_stp_bufsize=%d", buffer_size))
                return -1;
        return insert_module(modpath, bufsize_option, modoptions);
@@ -209,8 +210,17 @@ int init_staprun(void)
        else if (!attach_mod) {
                if (need_uprobes && enable_uprobes() != 0)
                        return -1;
-               if (insert_stap_module() < 0)
-                       return -1;
+               if (insert_stap_module() < 0) {
+                  /* staprun or stapio might have crashed or been SIGKILL'd,
+                     without first removing the kernel module.  This would block
+                     a subsequent rerun attempt.  So here we gingerly try to
+                     unload it first. */
+                  int ret = delete_module (modname, O_NONBLOCK);
+                  err("Retrying, after attempted removal of module %s (rc %d)\n", modname, ret); 
+                  /* Then we try an insert a second time.  */
+                  if (insert_stap_module() < 0)
+                    return -1;
+                }
                 if (send_relocations() < 0)
                        return -1;
        }
This page took 0.030121 seconds and 5 git commands to generate.