summaryrefslogtreecommitdiffstats
path: root/runtime/procfs.c
diff options
context:
space:
mode:
authorDavid Smith <dsmith@redhat.com>2009-07-06 09:16:28 -0500
committerDavid Smith <dsmith@redhat.com>2009-07-06 09:16:28 -0500
commit83eaf9b5f3d1f1287b7962efc6bc703357b984ba (patch)
tree4296110995e6e4f123de173885c3624c9333d83b /runtime/procfs.c
parent8e0049e8b601e9377875d2229104d78668f3f7ce (diff)
downloadsystemtap-steved-83eaf9b5f3d1f1287b7962efc6bc703357b984ba.tar.gz
systemtap-steved-83eaf9b5f3d1f1287b7962efc6bc703357b984ba.tar.xz
systemtap-steved-83eaf9b5f3d1f1287b7962efc6bc703357b984ba.zip
BZ 490234 fix.
* runtime/procfs.c (_stp_rmdir_proc_module): Now before removing either '/proc/systemtap/${MODULE}' or '/proc/systemtap', lock the transport directory. Also make sure '/proc/systemtap' is empty before removal.
Diffstat (limited to 'runtime/procfs.c')
-rw-r--r--runtime/procfs.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/runtime/procfs.c b/runtime/procfs.c
index d6b75336..1d2ad837 100644
--- a/runtime/procfs.c
+++ b/runtime/procfs.c
@@ -38,6 +38,11 @@ static void _stp_close_procfs(void);
*/
static void _stp_rmdir_proc_module(void)
{
+ if (!_stp_lock_transport_dir()) {
+ errk("Unable to lock transport directory.\n");
+ return;
+ }
+
if (_stp_proc_root && _stp_proc_root->subdir == NULL) {
if (atomic_read(&_stp_proc_root->count) != LAST_ENTRY_COUNT)
_stp_warn("Removal of /proc/systemtap/%s\nis deferred until it is no longer in use.\n"
@@ -46,12 +51,7 @@ static void _stp_rmdir_proc_module(void)
_stp_proc_root = NULL;
}
- if (_stp_proc_stap) {
- if (!_stp_lock_transport_dir()) {
- errk("Unable to lock transport directory.\n");
- return;
- }
-
+ if (_stp_proc_stap && _stp_proc_stap->subdir == NULL) {
/* Important! Do not attempt removal of /proc/systemtap */
/* if in use. This will put the PDE in deleted state */
/* pending usage count dropping to 0. During this time, */
@@ -63,9 +63,8 @@ static void _stp_rmdir_proc_module(void)
remove_proc_entry("systemtap", NULL);
_stp_proc_stap = NULL;
}
-
- _stp_unlock_transport_dir();
}
+ _stp_unlock_transport_dir();
}