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

From: Hugh Dickins
Date: Mon Jul 18 2011 - 22:08:26 EST


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@xxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxx>
---
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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/