public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@sw.ru>
To: Pavel Emelyanov <xemul@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Containers <containers@lists.osdl.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [Devel] Re: [PATCH resend] proc: Fix proc_kill_inodes to kill dentries on all proc superblocks
Date: Thu, 1 Nov 2007 18:59:38 +0300	[thread overview]
Message-ID: <20071101155938.GB16499@localhost.sw.ru> (raw)
In-Reply-To: <4729F549.6090905@openvz.org>

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.


  reply	other threads:[~2007-11-01 16:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-01 15:39 [PATCH resend] proc: Fix proc_kill_inodes to kill dentries on all proc superblocks Eric W. Biederman
2007-11-01 15:48 ` Pavel Emelyanov
2007-11-01 15:59   ` Alexey Dobriyan [this message]
2007-11-01 17:07     ` [Devel] " Eric W. Biederman
2007-11-01 19:57   ` sukadev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071101155938.GB16499@localhost.sw.ru \
    --to=adobriyan@sw.ru \
    --cc=akpm@linux-foundation.org \
    --cc=containers@lists.osdl.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xemul@openvz.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox