Doing revalidate on a dentry which has not yet been looked up makes no sense. Move the d_need_lookup() check before d_revalidate().
Unified · Split
| @@ -1139,6 +1139,8 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, · 1138 unmodified lines | ||
| 1139 | 1139 | return -ECHILD; |
| 1140 | 1140 | nd->seq = seq; |
| 1141 | 1141 | |
| 1142 | + if (unlikely(d_need_lookup(dentry))) | |
| 1143 | + goto unlazy; | |
| 1142 | 1144 | if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) { |
| 1143 | 1145 | status = d_revalidate(dentry, nd); |
| 1144 | 1146 | if (unlikely(status <= 0)) { |
| @@ -1147,8 +1149,6 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, · 2 unmodified lines | ||
| 1147 | 1149 | goto unlazy; |
| 1148 | 1150 | } |
| 1149 | 1151 | } |
| 1150 | − if (unlikely(d_need_lookup(dentry))) | |
| 1151 | − goto unlazy; | |
| 1152 | 1152 | path->mnt = mnt; |
| 1153 | 1153 | path->dentry = dentry; |
| 1154 | 1154 | if (unlikely(!__follow_mount_rcu(nd, path, inode))) |