mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue@us.ibm.com>
To: Pekka J Enberg <penberg@cs.helsinki.fi>
Cc: serge@hallyn.com, alan@redhat.com, viro@zeniv.linux.org.uk,
	hch@infradead.org, peterz@infradead.org,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [RFC/PATCH 2/8] revoke: inode revoke lock V7
Date: Wed, 19 Dec 2007 09:30:56 -0600	[thread overview]
Message-ID: <20071219153056.GA7574@sergelap.austin.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0712180923450.32179@sbz-30.cs.Helsinki.FI>

Quoting Pekka J Enberg (penberg@cs.helsinki.fi):
> Hi Serge,
> 
> (Thanks for looking at this. I appreciate the review!)
> 
> On Mon, 17 Dec 2007, serge@hallyn.com wrote:
> > >  	struct vfsmount *mnt = nd->mnt;
> > > -	struct dentry *dentry = __d_lookup(nd->dentry, name);
> > > +	struct dentry *dentry;
> > >  
> > > +again:
> > > +	dentry  = __d_lookup(nd->dentry, name);
> > >  	if (!dentry)
> > >  		goto need_lookup;
> > > +
> > > +	if (dentry->d_inode && IS_REVOKE_LOCKED(dentry->d_inode)) {
> > 
> > not sure whether this is a problem or not, but dentry->d_inode isn't
> > locked here, right?  So nothing is keeping do_lookup() returning
> > with an inode which gets revoked between here and the return 0
> > a few lines down?
> 
> I assume you mean S_REVOKE_LOCK and not ->i_mutex, right?

No I did mean the i_mutex since you take the i_mutex when you set
S_REVOKE_LOCK.  So between that and the comment above do_lookup(),
I assumed you were trying to lock out concurrent do_lookups() returning
an inode whose revoke is starting at the same time.

But based on your next paragraph it sounds like I misunderstand your
locking.

> The caller is supposed to block open(2) with chmod(2)/chattr(2) so while 
> revoke is in progress, you can get references to the _revoked inode_, 
> which is fine (operations on it will fail with EBADFS). The 
> ->i_revoke_wait bits are there to make sure that while we revoke, you 
> can't get a _new reference_ to the inode until we're done.

And a new reference means through iget(), so if revoke starts
between the IS_REVOKE_LOCKED() check in do_lookup and its return,
it's ok bc we'll get a reference later on?

I'm a little confused but i'll keep looking.

thanks,
-serge

  reply	other threads:[~2007-12-19 15:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-14 15:16 Pekka J Enberg
2007-12-17 22:28 ` serge
2007-12-18  7:31   ` Pekka J Enberg
2007-12-19 15:30     ` Serge E. Hallyn [this message]
2007-12-19 20:23       ` Pekka J Enberg
2007-12-19 20:30         ` Serge E. Hallyn
2007-12-18 16:31 ` Jonathan Corbet
2007-12-19  9:02   ` Pekka J Enberg

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=20071219153056.GA7574@sergelap.austin.ibm.com \
    --to=serue@us.ibm.com \
    --cc=alan@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    --cc=peterz@infradead.org \
    --cc=serge@hallyn.com \
    --cc=viro@zeniv.linux.org.uk \
    /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

all inboxes | Powered by JetHome®