From: Miklos Szeredi Date: Mon, 26 Mar 2012 10:54:19 +0000 (+0200) Subject: vfs: fix d_need_lookup/d_revalidate order in do_lookup X-Git-Tag: upstream/snapshot3+hdmi~7779^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fa4ee159512ee39b6c65ac40db986ea7a2f7de60;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git vfs: fix d_need_lookup/d_revalidate order in do_lookup Doing revalidate on a dentry which has not yet been looked up makes no sense. Move the d_need_lookup() check before d_revalidate(). Signed-off-by: Miklos Szeredi Signed-off-by: Al Viro --- diff --git a/fs/namei.c b/fs/namei.c index e615ff3..768f236 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1139,6 +1139,8 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, return -ECHILD; nd->seq = seq; + if (unlikely(d_need_lookup(dentry))) + goto unlazy; if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) { status = d_revalidate(dentry, nd); if (unlikely(status <= 0)) { @@ -1147,8 +1149,6 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, goto unlazy; } } - if (unlikely(d_need_lookup(dentry))) - goto unlazy; path->mnt = mnt; path->dentry = dentry; if (unlikely(!__follow_mount_rcu(nd, path, inode)))