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
1139 return -ECHILD;1139 return -ECHILD;
1140 nd->seq = seq;1140 nd->seq = seq;
1141 1141
1142 if (unlikely(d_need_lookup(dentry)))
1143 goto unlazy;
1142 if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) {1144 if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) {
1143 status = d_revalidate(dentry, nd);1145 status = d_revalidate(dentry, nd);
1144 if (unlikely(status <= 0)) {1146 if (unlikely(status <= 0)) {
@@ -1147,8 +1149,6 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, · 2 unmodified lines
1147 goto unlazy;1149 goto unlazy;
1148 }1150 }
1149 }1151 }
1150 if (unlikely(d_need_lookup(dentry)))
1151 goto unlazy;
1152 path->mnt = mnt;1152 path->mnt = mnt;
1153 path->dentry = dentry;1153 path->dentry = dentry;
1154 if (unlikely(!__follow_mount_rcu(nd, path, inode)))1154 if (unlikely(!__follow_mount_rcu(nd, path, inode)))