Re: [PATCH] vfs: fix race in rcu lookup of pruned dentry

Hugh Dickins
2011-07-19T02:08:17Z

On Tue, 19 Jul 2011, Al Viro wrote:
> On Mon, Jul 18, 2011 at 04:27:53PM -0700, Linus Torvalds wrote:
> > On Mon, Jul 18, 2011 at 4:21 PM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> > >
> > > Linus, are you OK with me slapping your s-o-b on it?
> >
> > Yup.
> >
> > And it feels so right that I think we should just do it for 3.0.

It looked sane, but in fact was insane. Enough testing for now,
I say it's good to go, if you fold in this small adjustment...

[PATCH] fix sense of __read_seqcount_retry test

Hah, good thing I hacked something in to check we're going the quick
way: __read_seqcount_retry() returns *true* when a retry is needed.

Signed-off-by: Hugh Dickins <hughd@google.com>
---
fs/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- 3.0-git+/fs/namei.c 2011-07-18 18:31:36.273731128 -0700
+++ linux/fs/namei.c 2011-07-18 18:32:35.158022444 -0700
@@ -960,7 +960,7 @@ static bool __follow_mount_rcu(struct na
* so we can use __read_seqcount_retry() to check the prev
* sequence numbers.
*/
- if (!__read_seqcount_retry(&path->dentry->d_seq, nd->seq))
+ if (__read_seqcount_retry(&path->dentry->d_seq, nd->seq))
return false;
path->mnt = mounted;
path->dentry = mounted->mnt_root;