]> sourceware.org Git - systemtap.git/commitdiff
2007-03-12 Frank Ch. Eigler <fche@redhat.com>
authorfche <fche>
Mon, 12 Mar 2007 17:15:30 +0000 (17:15 +0000)
committerfche <fche>
Mon, 12 Mar 2007 17:15:30 +0000 (17:15 +0000)
PR 4179.
Based on patch from Vasily Averin <vvs@sw.ru>:
* time.c (_stp_init_time): Recover from partial failures.

2007-03-12  Frank Ch. Eigler  <fche@redhat.com>

PR 4179.
Based on patch from Vasily Averin <vvs@sw.ru>:
* procfs.c (_stp_register_procfs): Recover from partial failures.
* transport.c (_stp_transport_open): Ditto.

runtime/ChangeLog
runtime/time.c
runtime/transport/ChangeLog
runtime/transport/procfs.c
runtime/transport/transport.c

index f54c8998f4e67b6aac0845aa0d853e4925bea9df..56aa0addcf48d1b011f7b690cef5f30c676d6c2d 100644 (file)
@@ -1,3 +1,9 @@
+2007-03-12  Frank Ch. Eigler  <fche@redhat.com>
+
+       PR 4179.
+       Based on patch from Vasily Averin <vvs@sw.ru>:
+       * time.c (_stp_init_time): Recover from partial failures.
+
 2007-03-01  David Wilder <dwilder@us.ibm.com>
 
        * loc2c-runtime.h: rewrote s390x version of __stp_put_asm
index 7f9b5ffae0564795f91ce8cb443f75be22ad6809..657b5e8cd0d43153a8307cd7e22dfabd945ceb22 100644 (file)
@@ -212,7 +212,8 @@ _stp_init_time(void)
         }
     }
 #endif
-
+   if (ret)
+        _stp_kill_time();
     return ret;
 }
 
index e0c4f3d2f3f486c222c62af641b893c286d5050a..ff092a9393a44a6b4441780ae82bfa1b7089c23b 100644 (file)
@@ -1,3 +1,10 @@
+2007-03-12  Frank Ch. Eigler  <fche@redhat.com>
+
+       PR 4179.
+       Based on patch from Vasily Averin <vvs@sw.ru>:
+       * procfs.c (_stp_register_procfs): Recover from partial failures.
+       * transport.c (_stp_transport_open): Ditto.
+
 2007-01-30  Martin Hunt  <hunt@redhat.com>
 
        * symbols.c: Comment out many debug lines.
index 136c6d0682c9c6373185dc9996c8c555d817a93c..ca243035717c34f179d4efbc26412cbbf4e0d80f 100644 (file)
@@ -1,7 +1,7 @@
 /* -*- linux-c -*-
  *
  * /proc transport and control
- * Copyright (C) 2005, 2006, 2007 Red Hat Inc.
+ * Copyright (C) 2005-2007 Red Hat Inc.
  *
  * This file is part of systemtap, and is free software.  You can
  * redistribute it and/or modify it under the terms of the GNU General
@@ -318,7 +318,7 @@ static int _stp_register_procfs (void)
                p = (struct list_head *)kmalloc(sizeof(struct _stp_buffer),STP_ALLOC_FLAGS);
                // printk("allocated buffer at %lx\n", (long)p);
                if (!p)
-                       goto err2;
+                       goto err0;
                _stp_allocated_net_memory += sizeof(struct _stp_buffer);
                list_add (p, &_stp_pool_q);
        }
@@ -368,12 +368,6 @@ static int _stp_register_procfs (void)
        de->proc_fops = &_stp_proc_fops_cmd;
        return 0;
 
-err2:
-       list_for_each_safe(p, tmp, &_stp_pool_q) {
-               list_del(p);
-               kfree(p);
-       }
-
 err1:
 #ifdef STP_RELAYFS
        for (de = _stp_proc_mod->subdir; de; de = de->next)
@@ -388,6 +382,11 @@ err1:
 #endif
        remove_proc_entry (THIS_MODULE->name, _stp_proc_root);
 err0:
+       list_for_each_safe(p, tmp, &_stp_pool_q) {
+               list_del(p);
+               kfree(p);
+       }
+
        printk (KERN_ERR "Error creating systemtap /proc entries.\n");
        return -1;
 }
@@ -410,7 +409,7 @@ static void _stp_unregister_procfs (void)
        }
 #endif
        remove_proc_entry ("cmd", _stp_proc_mod);
-       remove_proc_entry (THIS_MODULE->name, _stp_proc_root);
+       remove_proc_entry (THIS_MODULE->name, _stp_proc_root); /* XXX: race condition */
 
        /* free memory pools */
        list_for_each_safe(p, tmp, &_stp_pool_q) {
index 5bd6eb1680674b71092118838ad4f89869351841..de0e8c2dafc7b64a093b74082994a47bd20e9759 100644 (file)
@@ -2,7 +2,7 @@
  * transport.c - stp transport functions
  *
  * Copyright (C) IBM Corporation, 2005
- * Copyright (C) Red Hat Inc, 2005, 2006
+ * Copyright (C) Red Hat Inc, 2005-2007
  * Copyright (C) Intel Corporation, 2006
  *
  * This file is part of systemtap, and is free software.  You can
@@ -315,25 +315,41 @@ int _stp_transport_open(struct _stp_transport_info *info)
  */
 int _stp_transport_init(void)
 {
+       int ret;
+
        kbug("transport_init from %ld %ld\n", (long)_stp_pid, (long)current->pid);
 
        /* create print buffers */
-       if (_stp_print_init() < 0)
-               return -1;
+       ret = _stp_print_init();
+       if (ret < 0)
+               goto out;
 
        /* initialize timer code */
-       if (_stp_init_time())
-               return -1;      
+       ret =_stp_init_time();
+       if (ret)
+               goto print_cleanup;
 
        /* set up procfs communications */
-       if (_stp_register_procfs() < 0)
-               return -1;
+       ret = _stp_register_procfs();
+       if (ret < 0)
+               goto kill_time;
 
        /* create workqueue of kernel threads */
        _stp_wq = create_workqueue("systemtap");
+       if (!_stp_wq)
+          goto proc_cleanup;
        queue_delayed_work(_stp_wq, &_stp_work, STP_WORK_TIMER);
+out:
+       return ret;
 
-       return 0;
+proc_cleanup:
+       ret = -1;
+       _stp_unregister_procfs();
+kill_time:
+       _stp_kill_time();
+print_cleanup:
+       _stp_print_cleanup();   /* free print buffers */
+       goto out;
 }
 
 
This page took 0.03923 seconds and 5 git commands to generate.