diff options
author | hunt <hunt> | 2007-09-19 13:04:57 +0000 |
---|---|---|
committer | hunt <hunt> | 2007-09-19 13:04:57 +0000 |
commit | d5aae3f021d1a5d52e17788025053496757b7a89 (patch) | |
tree | 0267b25577262d0174c267bf3e6ec1961bf835ee /runtime/procfs.c | |
parent | 0ce78ee3745faf559734a01aef5b7a9e6c58f500 (diff) | |
download | systemtap-steved-d5aae3f021d1a5d52e17788025053496757b7a89.tar.gz systemtap-steved-d5aae3f021d1a5d52e17788025053496757b7a89.tar.xz systemtap-steved-d5aae3f021d1a5d52e17788025053496757b7a89.zip |
2007-09-19 Martin Hunt <hunt@redhat.com>
PR 5042
* procfs.c (_stp_rmdir_proc_module): Warn if removal of
/proc/systemtap/module is deferred. Do not defer removal of
/proc/systemtap.
(_stp_mkdir_proc_module): Call path_release(). Set ownership of
/proc/systemtap/module to force deletion to be deferred.
(_stp_create_procfs): Set owner of all path components.
Diffstat (limited to 'runtime/procfs.c')
-rw-r--r-- | runtime/procfs.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/runtime/procfs.c b/runtime/procfs.c index 9e028d78..eb0f845c 100644 --- a/runtime/procfs.c +++ b/runtime/procfs.c @@ -30,6 +30,9 @@ void _stp_close_procfs(void); void _stp_rmdir_proc_module(void) { if (_stp_proc_root && _stp_proc_root->subdir == NULL) { + if (atomic_read(&_stp_proc_root->count)) + _stp_warn("Removal of /proc/systemtap/%s\nis deferred until it is no longer in use.\n" + "Systemtap module removal will block.\n", THIS_MODULE->name); remove_proc_entry(THIS_MODULE->name, _stp_proc_stap); _stp_proc_root = NULL; } @@ -40,7 +43,14 @@ void _stp_rmdir_proc_module(void) return; } - if (_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, */ + /* path_lookup() will still find it and allow new */ + /* modules to use it, even though it will not show up */ + /* in directory listings. */ + + if (atomic_read(&_stp_proc_stap->count) == 0) { remove_proc_entry("systemtap", NULL); _stp_proc_stap = NULL; } @@ -76,10 +86,15 @@ int _stp_mkdir_proc_module(void) _stp_unlock_debugfs(); goto done; } - } else + } else { _stp_proc_stap = PDE(nd.dentry->d_inode); - + path_release (&nd); + } + _stp_proc_root = proc_mkdir(THIS_MODULE->name, _stp_proc_stap); + if (_stp_proc_root != NULL) + _stp_proc_root->owner = THIS_MODULE; + _stp_unlock_debugfs(); } done: @@ -133,6 +148,7 @@ int _stp_create_procfs(const char *path, int num) goto err; } _stp_pde[_stp_num_pde++] = last_dir; + last_dir->owner = THIS_MODULE; last_dir->uid = _stp_uid; last_dir->gid = _stp_gid; } else { |