History

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().

Miklos Szeredi committed 14 years ago

Commit fa4ee151 parent 4613ad11 file · +2 −2Browse files

Unified · Split

fs/namei.c+2−2
@@ -1139,6 +1139,8 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, · 1138 unmodified lines
11391139 return -ECHILD;
11401140 nd->seq = seq;
11411141
1142+ if (unlikely(d_need_lookup(dentry)))
1143+ goto unlazy;
11421144 if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) {
11431145 status = d_revalidate(dentry, nd);
11441146 if (unlikely(status <= 0)) {
@@ -1147,8 +1149,6 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, · 2 unmodified lines
11471149 goto unlazy;
11481150 }
11491151 }
1150− if (unlikely(d_need_lookup(dentry)))
1151− goto unlazy;
11521152 path->mnt = mnt;
11531153 path->dentry = dentry;
11541154 if (unlikely(!__follow_mount_rcu(nd, path, inode)))