Commit 08b0ab7c authored by Al Viro's avatar Al Viro

untangling do_lookup() - get rid of need_reval in !dentry case

Everything arriving into if (!dentry) will have need_reval = 1.
Indeed, the only way to get there with need_reval reset to 0 would
be via
	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)) {
		if (status != -ECHILD)
			need_reval = 0;
		goto unlazy;
...
unlazy:
	/* no assignments to dentry */
	if (dentry && unlikely(d_need_lookup(dentry))) {
		dput(dentry);
		dentry = NULL;
	}
and if d_need_lookup() had already been false the first time around, it
will remain false on the second call as well.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent acc9cb3c
...@@ -1181,7 +1181,6 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, ...@@ -1181,7 +1181,6 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
return PTR_ERR(dentry); return PTR_ERR(dentry);
} }
/* known good */ /* known good */
need_reval = 0;
status = 1; status = 1;
} else if (unlikely(d_need_lookup(dentry))) { } else if (unlikely(d_need_lookup(dentry))) {
dentry = d_inode_lookup(parent, dentry, nd); dentry = d_inode_lookup(parent, dentry, nd);
...@@ -1190,10 +1189,8 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, ...@@ -1190,10 +1189,8 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
return PTR_ERR(dentry); return PTR_ERR(dentry);
} }
/* known good */ /* known good */
need_reval = 0;
status = 1; status = 1;
} } else if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE))
if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE) && need_reval)
status = d_revalidate(dentry, nd); status = d_revalidate(dentry, nd);
if (unlikely(status <= 0)) { if (unlikely(status <= 0)) {
if (status < 0) { if (status < 0) {
...@@ -1209,7 +1206,6 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, ...@@ -1209,7 +1206,6 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
return PTR_ERR(dentry); return PTR_ERR(dentry);
} }
/* known good */ /* known good */
need_reval = 0;
status = 1; status = 1;
} }
} }
...@@ -1226,7 +1222,6 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, ...@@ -1226,7 +1222,6 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
if (!d_invalidate(dentry)) { if (!d_invalidate(dentry)) {
dput(dentry); dput(dentry);
dentry = NULL; dentry = NULL;
need_reval = 1;
goto retry; goto retry;
} }
} }
......
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