Commit ec335e91 authored by Al Viro's avatar Al Viro

untangling do_lookup() - merge failure exits in !dentry case

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent d774a058
...@@ -1176,35 +1176,28 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, ...@@ -1176,35 +1176,28 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
dentry = d_lookup(parent, name); dentry = d_lookup(parent, name);
if (dentry && d_need_lookup(dentry)) { if (dentry && d_need_lookup(dentry)) {
dentry = d_inode_lookup(parent, dentry, nd); dentry = d_inode_lookup(parent, dentry, nd);
if (IS_ERR(dentry)) { goto l;
mutex_unlock(&dir->i_mutex);
return PTR_ERR(dentry);
} }
} else if (dentry && (dentry->d_flags & DCACHE_OP_REVALIDATE)) { if (dentry && (dentry->d_flags & DCACHE_OP_REVALIDATE)) {
status = d_revalidate(dentry, nd); status = d_revalidate(dentry, nd);
if (unlikely(status <= 0)) { if (unlikely(status <= 0)) {
if (status < 0) { if (status < 0) {
mutex_unlock(&dir->i_mutex);
dput(dentry); dput(dentry);
return status; dentry = ERR_PTR(status);
goto l;
} }
if (!d_invalidate(dentry)) { if (!d_invalidate(dentry)) {
dput(dentry); dput(dentry);
dentry = d_alloc_and_lookup(parent, name, nd); dentry = d_alloc_and_lookup(parent, name, nd);
if (IS_ERR(dentry)) {
mutex_unlock(&dir->i_mutex);
return PTR_ERR(dentry);
}
} }
} }
} else if (!dentry) { } else if (!dentry) {
dentry = d_alloc_and_lookup(parent, name, nd); dentry = d_alloc_and_lookup(parent, name, nd);
if (IS_ERR(dentry)) {
mutex_unlock(&dir->i_mutex);
return PTR_ERR(dentry);
}
} }
l:
mutex_unlock(&dir->i_mutex); mutex_unlock(&dir->i_mutex);
if (IS_ERR(dentry))
return PTR_ERR(dentry);
goto done; goto done;
} }
if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE) && need_reval) if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE) && need_reval)
......
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