* [PATCH resend] proc: Fix proc_kill_inodes to kill dentries on all proc superblocks
@ 2007-11-01 15:39 Eric W. Biederman
[not found] ` <m1ir4mezzy.fsf-T1Yj925okcoyDheHMi7gv2pdwda3JcWeAL8bYrjMMd8@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Eric W. Biederman @ 2007-11-01 15:39 UTC (permalink / raw)
To: Andrew Morton
Cc: Linux Containers, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
Pavel Emelyanov
It appears we overlooked support for removing generic proc files
when we added support for multiple proc super blocks. Handle
that now.
Signed-off-by: Eric W. Biederman <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
---
fs/proc/generic.c | 38 +++++++++++++++++++++-----------------
fs/proc/internal.h | 2 ++
fs/proc/root.c | 2 +-
3 files changed, 24 insertions(+), 18 deletions(-)
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 1bdb624..3906770 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -561,28 +561,32 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp
static void proc_kill_inodes(struct proc_dir_entry *de)
{
struct list_head *p;
- struct super_block *sb = proc_mnt->mnt_sb;
+ struct super_block *sb;
/*
* Actually it's a partial revoke().
*/
- file_list_lock();
- list_for_each(p, &sb->s_files) {
- struct file * filp = list_entry(p, struct file, f_u.fu_list);
- struct dentry * dentry = filp->f_path.dentry;
- struct inode * inode;
- const struct file_operations *fops;
-
- if (dentry->d_op != &proc_dentry_operations)
- continue;
- inode = dentry->d_inode;
- if (PDE(inode) != de)
- continue;
- fops = filp->f_op;
- filp->f_op = NULL;
- fops_put(fops);
+ spin_lock(&sb_lock);
+ list_for_each_entry(sb, &proc_fs_type.fs_supers, s_instances) {
+ file_list_lock();
+ list_for_each(p, &sb->s_files) {
+ struct file * filp = list_entry(p, struct file, f_u.fu_list);
+ struct dentry * dentry = filp->f_path.dentry;
+ struct inode * inode;
+ const struct file_operations *fops;
+
+ if (dentry->d_op != &proc_dentry_operations)
+ continue;
+ inode = dentry->d_inode;
+ if (PDE(inode) != de)
+ continue;
+ fops = filp->f_op;
+ filp->f_op = NULL;
+ 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,
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index 1820eb2..1b2b6c6 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -78,3 +78,5 @@ static inline int proc_fd(struct inode *inode)
{
return PROC_I(inode)->fd;
}
+
+extern struct file_system_type proc_fs_type;
diff --git a/fs/proc/root.c b/fs/proc/root.c
index ec9cb3b..1f86bb8 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -98,7 +98,7 @@ static void proc_kill_sb(struct super_block *sb)
put_pid_ns(ns);
}
-static struct file_system_type proc_fs_type = {
+struct file_system_type proc_fs_type = {
.name = "proc",
.get_sb = proc_get_sb,
.kill_sb = proc_kill_sb,
--
1.5.3.rc6.17.g1911
^ permalink raw reply related [flat|nested] 5+ messages in thread[parent not found: <m1ir4mezzy.fsf-T1Yj925okcoyDheHMi7gv2pdwda3JcWeAL8bYrjMMd8@public.gmane.org>]
* Re: [PATCH resend] proc: Fix proc_kill_inodes to kill dentries on all proc superblocks [not found] ` <m1ir4mezzy.fsf-T1Yj925okcoyDheHMi7gv2pdwda3JcWeAL8bYrjMMd8@public.gmane.org> @ 2007-11-01 15:48 ` Pavel Emelyanov 2007-11-01 15:59 ` [Devel] " Alexey Dobriyan 2007-11-01 19:57 ` sukadev 0 siblings, 2 replies; 5+ messages in thread From: Pavel Emelyanov @ 2007-11-01 15:48 UTC (permalink / raw) To: Eric W. Biederman, Andrew Morton Cc: Linux Containers, linux-kernel-u79uwXL29TY76Z2rM5mHXA Eric W. Biederman wrote: > It appears we overlooked support for removing generic proc files > when we added support for multiple proc super blocks. Handle > that now. > > Signed-off-by: Eric W. Biederman <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org> AFAIS this is just making the kill for all the super blocks we have. Acked-by: Pavel Emelyanov <xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org> > --- > fs/proc/generic.c | 38 +++++++++++++++++++++----------------- > fs/proc/internal.h | 2 ++ > fs/proc/root.c | 2 +- > 3 files changed, 24 insertions(+), 18 deletions(-) > > diff --git a/fs/proc/generic.c b/fs/proc/generic.c > index 1bdb624..3906770 100644 > --- a/fs/proc/generic.c > +++ b/fs/proc/generic.c > @@ -561,28 +561,32 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp > static void proc_kill_inodes(struct proc_dir_entry *de) > { > struct list_head *p; > - struct super_block *sb = proc_mnt->mnt_sb; > + struct super_block *sb; > > /* > * Actually it's a partial revoke(). > */ > - file_list_lock(); > - list_for_each(p, &sb->s_files) { > - struct file * filp = list_entry(p, struct file, f_u.fu_list); > - struct dentry * dentry = filp->f_path.dentry; > - struct inode * inode; > - const struct file_operations *fops; > - > - if (dentry->d_op != &proc_dentry_operations) > - continue; > - inode = dentry->d_inode; > - if (PDE(inode) != de) > - continue; > - fops = filp->f_op; > - filp->f_op = NULL; > - fops_put(fops); > + spin_lock(&sb_lock); > + list_for_each_entry(sb, &proc_fs_type.fs_supers, s_instances) { > + file_list_lock(); > + list_for_each(p, &sb->s_files) { > + struct file * filp = list_entry(p, struct file, f_u.fu_list); > + struct dentry * dentry = filp->f_path.dentry; > + struct inode * inode; > + const struct file_operations *fops; > + > + if (dentry->d_op != &proc_dentry_operations) > + continue; > + inode = dentry->d_inode; > + if (PDE(inode) != de) > + continue; > + fops = filp->f_op; > + filp->f_op = NULL; > + 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, > diff --git a/fs/proc/internal.h b/fs/proc/internal.h > index 1820eb2..1b2b6c6 100644 > --- a/fs/proc/internal.h > +++ b/fs/proc/internal.h > @@ -78,3 +78,5 @@ static inline int proc_fd(struct inode *inode) > { > return PROC_I(inode)->fd; > } > + > +extern struct file_system_type proc_fs_type; > diff --git a/fs/proc/root.c b/fs/proc/root.c > index ec9cb3b..1f86bb8 100644 > --- a/fs/proc/root.c > +++ b/fs/proc/root.c > @@ -98,7 +98,7 @@ static void proc_kill_sb(struct super_block *sb) > put_pid_ns(ns); > } > > -static struct file_system_type proc_fs_type = { > +struct file_system_type proc_fs_type = { > .name = "proc", > .get_sb = proc_get_sb, > .kill_sb = proc_kill_sb, ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Devel] Re: [PATCH resend] proc: Fix proc_kill_inodes to kill dentries on all proc superblocks 2007-11-01 15:48 ` Pavel Emelyanov @ 2007-11-01 15:59 ` Alexey Dobriyan 2007-11-01 17:07 ` Eric W. Biederman 2007-11-01 19:57 ` sukadev 1 sibling, 1 reply; 5+ messages in thread From: Alexey Dobriyan @ 2007-11-01 15:59 UTC (permalink / raw) To: Pavel Emelyanov Cc: Eric W. Biederman, Andrew Morton, Linux Containers, linux-kernel On Thu, Nov 01, 2007 at 06:48:25PM +0300, Pavel Emelyanov wrote: > Eric W. Biederman wrote: > > It appears we overlooked support for removing generic proc files > > when we added support for multiple proc super blocks. Handle > > that now. > > > > Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> > > AFAIS this is just making the kill for all the super blocks > we have. > > Acked-by: Pavel Emelyanov <xemul@openvz.org> bzzrt, this function is executed only for directories and symlinks, obviously buggy (you can't flip ->f_op on live file) and is going away after readdir/rmmod races for directories will be dealt the same way as for regular file. > > --- a/fs/proc/generic.c > > +++ b/fs/proc/generic.c > > @@ -561,28 +561,32 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp > > static void proc_kill_inodes(struct proc_dir_entry *de) > > { > > struct list_head *p; > > - struct super_block *sb = proc_mnt->mnt_sb; > > + struct super_block *sb; > > > > /* > > * Actually it's a partial revoke(). > > */ > > - file_list_lock(); > > - list_for_each(p, &sb->s_files) { > > - struct file * filp = list_entry(p, struct file, f_u.fu_list); > > - struct dentry * dentry = filp->f_path.dentry; > > - struct inode * inode; > > - const struct file_operations *fops; > > - > > - if (dentry->d_op != &proc_dentry_operations) > > - continue; > > - inode = dentry->d_inode; > > - if (PDE(inode) != de) > > - continue; > > - fops = filp->f_op; > > - filp->f_op = NULL; > > - fops_put(fops); > > + spin_lock(&sb_lock); > > + list_for_each_entry(sb, &proc_fs_type.fs_supers, s_instances) { > > + file_list_lock(); > > + list_for_each(p, &sb->s_files) { > > + struct file * filp = list_entry(p, struct file, f_u.fu_list); > > + struct dentry * dentry = filp->f_path.dentry; > > + struct inode * inode; > > + const struct file_operations *fops; > > + > > + if (dentry->d_op != &proc_dentry_operations) > > + continue; > > + inode = dentry->d_inode; > > + if (PDE(inode) != de) > > + continue; > > + fops = filp->f_op; > > + filp->f_op = NULL; > > + fops_put(fops); > > + } > > + file_list_unlock(); > > } > > - file_list_unlock(); > > + spin_unlock(&sb_lock); > > } Yup, all this bogo-revoke is going away RSN. you just kicked my lazy ass. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Devel] Re: [PATCH resend] proc: Fix proc_kill_inodes to kill dentries on all proc superblocks 2007-11-01 15:59 ` [Devel] " Alexey Dobriyan @ 2007-11-01 17:07 ` Eric W. Biederman 0 siblings, 0 replies; 5+ messages in thread From: Eric W. Biederman @ 2007-11-01 17:07 UTC (permalink / raw) To: Alexey Dobriyan Cc: Pavel Emelyanov, Andrew Morton, Linux Containers, linux-kernel Alexey Dobriyan <adobriyan@sw.ru> writes: > Yup, all this bogo-revoke is going away RSN. you just kicked my lazy ass. As long as the issue is fixed I don't care. Eric ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH resend] proc: Fix proc_kill_inodes to kill dentries on all proc superblocks 2007-11-01 15:48 ` Pavel Emelyanov 2007-11-01 15:59 ` [Devel] " Alexey Dobriyan @ 2007-11-01 19:57 ` sukadev 1 sibling, 0 replies; 5+ messages in thread From: sukadev @ 2007-11-01 19:57 UTC (permalink / raw) To: Pavel Emelyanov Cc: Eric W. Biederman, Andrew Morton, linux-kernel, Linux Containers Pavel Emelianov [xemul@openvz.org] wrote: | Eric W. Biederman wrote: | > It appears we overlooked support for removing generic proc files | > when we added support for multiple proc super blocks. Handle | > that now. | > | > Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> | | AFAIS this is just making the kill for all the super blocks | we have. | | Acked-by: Pavel Emelyanov <xemul@openvz.org> Acked-by: Sukadev Bhattiprolu <sukadev@us.ibm.com> | | > --- | > fs/proc/generic.c | 38 +++++++++++++++++++++----------------- | > fs/proc/internal.h | 2 ++ | > fs/proc/root.c | 2 +- | > 3 files changed, 24 insertions(+), 18 deletions(-) | > | > diff --git a/fs/proc/generic.c b/fs/proc/generic.c | > index 1bdb624..3906770 100644 | > --- a/fs/proc/generic.c | > +++ b/fs/proc/generic.c | > @@ -561,28 +561,32 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp | > static void proc_kill_inodes(struct proc_dir_entry *de) | > { | > struct list_head *p; | > - struct super_block *sb = proc_mnt->mnt_sb; | > + struct super_block *sb; | > | > /* | > * Actually it's a partial revoke(). | > */ | > - file_list_lock(); | > - list_for_each(p, &sb->s_files) { | > - struct file * filp = list_entry(p, struct file, f_u.fu_list); | > - struct dentry * dentry = filp->f_path.dentry; | > - struct inode * inode; | > - const struct file_operations *fops; | > - | > - if (dentry->d_op != &proc_dentry_operations) | > - continue; | > - inode = dentry->d_inode; | > - if (PDE(inode) != de) | > - continue; | > - fops = filp->f_op; | > - filp->f_op = NULL; | > - fops_put(fops); | > + spin_lock(&sb_lock); | > + list_for_each_entry(sb, &proc_fs_type.fs_supers, s_instances) { | > + file_list_lock(); | > + list_for_each(p, &sb->s_files) { | > + struct file * filp = list_entry(p, struct file, f_u.fu_list); | > + struct dentry * dentry = filp->f_path.dentry; | > + struct inode * inode; | > + const struct file_operations *fops; | > + | > + if (dentry->d_op != &proc_dentry_operations) | > + continue; | > + inode = dentry->d_inode; | > + if (PDE(inode) != de) | > + continue; | > + fops = filp->f_op; | > + filp->f_op = NULL; | > + 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, | > diff --git a/fs/proc/internal.h b/fs/proc/internal.h | > index 1820eb2..1b2b6c6 100644 | > --- a/fs/proc/internal.h | > +++ b/fs/proc/internal.h | > @@ -78,3 +78,5 @@ static inline int proc_fd(struct inode *inode) | > { | > return PROC_I(inode)->fd; | > } | > + | > +extern struct file_system_type proc_fs_type; | > diff --git a/fs/proc/root.c b/fs/proc/root.c | > index ec9cb3b..1f86bb8 100644 | > --- a/fs/proc/root.c | > +++ b/fs/proc/root.c | > @@ -98,7 +98,7 @@ static void proc_kill_sb(struct super_block *sb) | > put_pid_ns(ns); | > } | > | > -static struct file_system_type proc_fs_type = { | > +struct file_system_type proc_fs_type = { | > .name = "proc", | > .get_sb = proc_get_sb, | > .kill_sb = proc_kill_sb, ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-11-01 19:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-01 15:39 [PATCH resend] proc: Fix proc_kill_inodes to kill dentries on all proc superblocks Eric W. Biederman
[not found] ` <m1ir4mezzy.fsf-T1Yj925okcoyDheHMi7gv2pdwda3JcWeAL8bYrjMMd8@public.gmane.org>
2007-11-01 15:48 ` Pavel Emelyanov
2007-11-01 15:59 ` [Devel] " Alexey Dobriyan
2007-11-01 17:07 ` Eric W. Biederman
2007-11-01 19:57 ` sukadev
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox