linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ted Ts'o <tytso@mit.edu>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Ext4 Developers List <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH] ext4: fix races in ext4_sync_parent()
Date: Wed, 27 Jul 2011 20:34:22 -0400	[thread overview]
Message-ID: <20110728003421.GA3133@thunk.org> (raw)
In-Reply-To: <20110727011554.GN22133@ZenIV.linux.org.uk>

On Wed, Jul 27, 2011 at 02:15:54AM +0100, Al Viro wrote:
> On Tue, Jul 26, 2011 at 09:13:12PM -0400, Theodore Ts'o wrote:
> > +	inode = igrab(inode);
> > +	while (ext4_test_inode_state(inode, EXT4_STATE_NEWENTRY)) {
> >  		ext4_clear_inode_state(inode, EXT4_STATE_NEWENTRY);
> > -		dentry = list_entry(inode->i_dentry.next,
> > -				    struct dentry, d_alias);
> > -		if (!dentry || !dentry->d_parent || !dentry->d_parent->d_inode)
> > +		dentry = list_first_entry(&inode->i_dentry,
> > +					  struct dentry, d_alias);
> 
> ... and what if you don't have a dentry for that inode anymore?

I thought you were complaining that dentry could never be NULL
earlier?  We earlier checked for NULL, but I figured you knew
something I didn't....

> > +		next = igrab(dentry->d_parent->d_inode);
> 
> what protects you against rename() (OK, d_mode()) here?

Does it matter?  We'll get either the old or the new parent directory,
but either way it will be a valid inode, right?  Or am I missing
something?

						- Ted

  reply	other threads:[~2011-07-28  0:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-27  1:13 [PATCH] ext4: fix races in ext4_sync_parent() Theodore Ts'o
2011-07-27  1:15 ` Al Viro
2011-07-28  0:34   ` Ted Ts'o [this message]
2011-07-28  1:11     ` Al Viro
2011-07-30 16:32       ` Ted Ts'o
2011-07-30 16:42         ` Al Viro

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=20110728003421.GA3133@thunk.org \
    --to=tytso@mit.edu \
    --cc=linux-ext4@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).