Commit e1a1c997 authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Linus Torvalds

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: default avatarEric W. Biederman <ebiederm@xmission.com>
Acked-by: default avatarPavel Emelyanov <xemul@openvz.org>
Cc: Alexey Dobriyan <adobriyan@sw.ru>
Acked-by: default avatarSukadev Bhattiprolu <sukadev@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 71054585
...@@ -561,16 +561,19 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp ...@@ -561,16 +561,19 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp
static void proc_kill_inodes(struct proc_dir_entry *de) static void proc_kill_inodes(struct proc_dir_entry *de)
{ {
struct list_head *p; struct list_head *p;
struct super_block *sb = proc_mnt->mnt_sb; struct super_block *sb;
/* /*
* Actually it's a partial revoke(). * Actually it's a partial revoke().
*/ */
spin_lock(&sb_lock);
list_for_each_entry(sb, &proc_fs_type.fs_supers, s_instances) {
file_list_lock(); file_list_lock();
list_for_each(p, &sb->s_files) { list_for_each(p, &sb->s_files) {
struct file * filp = list_entry(p, struct file, f_u.fu_list); struct file *filp = list_entry(p, struct file,
struct dentry * dentry = filp->f_path.dentry; f_u.fu_list);
struct inode * inode; struct dentry *dentry = filp->f_path.dentry;
struct inode *inode;
const struct file_operations *fops; const struct file_operations *fops;
if (dentry->d_op != &proc_dentry_operations) if (dentry->d_op != &proc_dentry_operations)
...@@ -583,6 +586,8 @@ static void proc_kill_inodes(struct proc_dir_entry *de) ...@@ -583,6 +586,8 @@ static void proc_kill_inodes(struct proc_dir_entry *de)
fops_put(fops); fops_put(fops);
} }
file_list_unlock(); file_list_unlock();
}
spin_unlock(&sb_lock);
} }
static struct proc_dir_entry *proc_create(struct proc_dir_entry **parent, static struct proc_dir_entry *proc_create(struct proc_dir_entry **parent,
......
...@@ -78,3 +78,5 @@ static inline int proc_fd(struct inode *inode) ...@@ -78,3 +78,5 @@ static inline int proc_fd(struct inode *inode)
{ {
return PROC_I(inode)->fd; return PROC_I(inode)->fd;
} }
extern struct file_system_type proc_fs_type;
...@@ -98,7 +98,7 @@ static void proc_kill_sb(struct super_block *sb) ...@@ -98,7 +98,7 @@ static void proc_kill_sb(struct super_block *sb)
put_pid_ns(ns); put_pid_ns(ns);
} }
static struct file_system_type proc_fs_type = { struct file_system_type proc_fs_type = {
.name = "proc", .name = "proc",
.get_sb = proc_get_sb, .get_sb = proc_get_sb,
.kill_sb = proc_kill_sb, .kill_sb = proc_kill_sb,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment