Commit fa4ee159 authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Al Viro

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: default avatarMiklos Szeredi <mszeredi@suse.cz>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 4613ad18
...@@ -1139,6 +1139,8 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, ...@@ -1139,6 +1139,8 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
return -ECHILD; return -ECHILD;
nd->seq = seq; nd->seq = seq;
if (unlikely(d_need_lookup(dentry)))
goto unlazy;
if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) { if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) {
status = d_revalidate(dentry, nd); status = d_revalidate(dentry, nd);
if (unlikely(status <= 0)) { if (unlikely(status <= 0)) {
...@@ -1147,8 +1149,6 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, ...@@ -1147,8 +1149,6 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
goto unlazy; goto unlazy;
} }
} }
if (unlikely(d_need_lookup(dentry)))
goto unlazy;
path->mnt = mnt; path->mnt = mnt;
path->dentry = dentry; path->dentry = dentry;
if (unlikely(!__follow_mount_rcu(nd, path, inode))) if (unlikely(!__follow_mount_rcu(nd, path, inode)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment