summaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2017-01-09 07:35:39 +0100
committerAl Viro <viro@zeniv.linux.org.uk>2017-01-09 07:35:39 +0100
commit209a7fb2104f2724f651870306c65f86850ee953 (patch)
tree16397127b4d7293e20c89ced78c69f3be4f131fa /fs/namei.c
parentnamei: fold unlazy_link() into its sole caller (diff)
downloadlinux-209a7fb2104f2724f651870306c65f86850ee953.tar.xz
linux-209a7fb2104f2724f651870306c65f86850ee953.zip
lookup_fast(): clean up the logics around the fallback to non-rcu mode
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/fs/namei.c b/fs/namei.c
index f08eca2b788b..dfe6e32aeec6 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1558,12 +1558,7 @@ static int lookup_fast(struct nameidata *nd,
*seqp = seq;
if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE))
status = d_revalidate(dentry, nd->flags);
- if (unlikely(status <= 0)) {
- if (unlazy_walk(nd, dentry, seq))
- return -ECHILD;
- if (status == -ECHILD)
- status = d_revalidate(dentry, nd->flags);
- } else {
+ if (likely(status > 0)) {
/*
* Note: do negative dentry check after revalidation in
* case that drops it.
@@ -1574,9 +1569,12 @@ static int lookup_fast(struct nameidata *nd,
path->dentry = dentry;
if (likely(__follow_mount_rcu(nd, path, inode, seqp)))
return 1;
- if (unlazy_walk(nd, dentry, seq))
- return -ECHILD;
}
+ if (unlazy_walk(nd, dentry, seq))
+ return -ECHILD;
+ if (unlikely(status == -ECHILD))
+ /* we'd been told to redo it in non-rcu mode */
+ status = d_revalidate(dentry, nd->flags);
} else {
dentry = __d_lookup(parent, &nd->last);
if (unlikely(!dentry))