diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2007-11-14 19:59:08 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-14 21:45:38 -0500 |
commit | e1a1c997afe907e6ec4799e4be0f38cffd8b418c (patch) | |
tree | 3c1154a95c0a44a1015f3bfeb7e73d19024924cb /fs | |
parent | 7105458563213b6f6fb523065474cfe1d6c22a67 (diff) |
proc: fix proc_kill_inodes to kill dentries on all proc superblocks
It appears we overlooked support for removing generic proc files
when we added support for multiple proc super blocks. Handle
that now.
[akpm@linux-foundation.org: coding-style cleanups]
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: Pavel Emelyanov <xemul@openvz.org>
Cc: Alexey Dobriyan <adobriyan@sw.ru>
Acked-by: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/proc/generic.c | 39 | ||||
-rw-r--r-- | fs/proc/internal.h | 2 | ||||
-rw-r--r-- | fs/proc/root.c | 2 |
3 files changed, 25 insertions, 18 deletions
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 1bdb62435758..a9806bc21ec3 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -561,28 +561,33 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp | |||
561 | static void proc_kill_inodes(struct proc_dir_entry *de) | 561 | static void proc_kill_inodes(struct proc_dir_entry *de) |
562 | { | 562 | { |
563 | struct list_head *p; | 563 | struct list_head *p; |
564 | struct super_block *sb = proc_mnt->mnt_sb; | 564 | struct super_block *sb; |
565 | 565 | ||
566 | /* | 566 | /* |
567 | * Actually it's a partial revoke(). | 567 | * Actually it's a partial revoke(). |
568 | */ | 568 | */ |
569 | file_list_lock(); | 569 | spin_lock(&sb_lock); |
570 | list_for_each(p, &sb->s_files) { | 570 | list_for_each_entry(sb, &proc_fs_type.fs_supers, s_instances) { |
571 | struct file * filp = list_entry(p, struct file, f_u.fu_list); | 571 | file_list_lock(); |
572 | struct dentry * dentry = filp->f_path.dentry; | 572 | list_for_each(p, &sb->s_files) { |
573 | struct inode * inode; | 573 | struct file *filp = list_entry(p, struct file, |
574 | const struct file_operations *fops; | 574 | f_u.fu_list); |
575 | 575 | struct dentry *dentry = filp->f_path.dentry; | |
576 | if (dentry->d_op != &proc_dentry_operations) | 576 | struct inode *inode; |
577 | continue; | 577 | const struct file_operations *fops; |
578 | inode = dentry->d_inode; | 578 | |
579 | if (PDE(inode) != de) | 579 | if (dentry->d_op != &proc_dentry_operations) |
580 | continue; | 580 | continue; |
581 | fops = filp->f_op; | 581 | inode = dentry->d_inode; |
582 | filp->f_op = NULL; | 582 | if (PDE(inode) != de) |
583 | fops_put(fops); | 583 | continue; |
584 | fops = filp->f_op; | ||
585 | filp->f_op = NULL; | ||
586 | fops_put(fops); | ||
587 | } | ||
588 | file_list_unlock(); | ||
584 | } | 589 | } |
585 | file_list_unlock(); | 590 | spin_unlock(&sb_lock); |
586 | } | 591 | } |
587 | 592 | ||
588 | static struct proc_dir_entry *proc_create(struct proc_dir_entry **parent, | 593 | static struct proc_dir_entry *proc_create(struct proc_dir_entry **parent, |
diff --git a/fs/proc/internal.h b/fs/proc/internal.h index 1820eb2ef762..1b2b6c6bb475 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h | |||
@@ -78,3 +78,5 @@ static inline int proc_fd(struct inode *inode) | |||
78 | { | 78 | { |
79 | return PROC_I(inode)->fd; | 79 | return PROC_I(inode)->fd; |
80 | } | 80 | } |
81 | |||
82 | extern struct file_system_type proc_fs_type; | ||
diff --git a/fs/proc/root.c b/fs/proc/root.c index ec9cb3b6c93b..1f86bb860e04 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c | |||
@@ -98,7 +98,7 @@ static void proc_kill_sb(struct super_block *sb) | |||
98 | put_pid_ns(ns); | 98 | put_pid_ns(ns); |
99 | } | 99 | } |
100 | 100 | ||
101 | static struct file_system_type proc_fs_type = { | 101 | struct file_system_type proc_fs_type = { |
102 | .name = "proc", | 102 | .name = "proc", |
103 | .get_sb = proc_get_sb, | 103 | .get_sb = proc_get_sb, |
104 | .kill_sb = proc_kill_sb, | 104 | .kill_sb = proc_kill_sb, |