Commit 37c17e1f authored by Al Viro's avatar Al Viro

untangling do_lookup() - expand the area under ->i_mutex

keep holding ->i_mutex over revalidation parts
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 3f6c7c71
...@@ -1173,6 +1173,7 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, ...@@ -1173,6 +1173,7 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
BUG_ON(nd->inode != dir); BUG_ON(nd->inode != dir);
mutex_lock(&dir->i_mutex); mutex_lock(&dir->i_mutex);
l:
dentry = d_lookup(parent, name); dentry = d_lookup(parent, name);
if (likely(!dentry)) { if (likely(!dentry)) {
dentry = d_alloc_and_lookup(parent, name, nd); dentry = d_alloc_and_lookup(parent, name, nd);
...@@ -1193,11 +1194,11 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, ...@@ -1193,11 +1194,11 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
need_reval = 0; need_reval = 0;
status = 1; status = 1;
} }
mutex_unlock(&dir->i_mutex);
if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE) && need_reval) 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) {
mutex_unlock(&dir->i_mutex);
dput(dentry); dput(dentry);
return status; return status;
} }
...@@ -1205,9 +1206,10 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, ...@@ -1205,9 +1206,10 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
dput(dentry); dput(dentry);
dentry = NULL; dentry = NULL;
need_reval = 1; need_reval = 1;
goto retry; goto l;
} }
} }
mutex_unlock(&dir->i_mutex);
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