Skip to content

Commit

Permalink
untangling do_lookup() - expand the area under ->i_mutex
Browse files Browse the repository at this point in the history
keep holding ->i_mutex over revalidation parts

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Mar 31, 2012
1 parent 3f6c7c7 commit 37c17e1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,7 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
BUG_ON(nd->inode != dir);

mutex_lock(&dir->i_mutex);
l:
dentry = d_lookup(parent, name);
if (likely(!dentry)) {
dentry = d_alloc_and_lookup(parent, name, nd);
Expand All @@ -1193,21 +1194,22 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
need_reval = 0;
status = 1;
}
mutex_unlock(&dir->i_mutex);
if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE) && need_reval)
status = d_revalidate(dentry, nd);
if (unlikely(status <= 0)) {
if (status < 0) {
mutex_unlock(&dir->i_mutex);
dput(dentry);
return status;
}
if (!d_invalidate(dentry)) {
dput(dentry);
dentry = NULL;
need_reval = 1;
goto retry;
goto l;
}
}
mutex_unlock(&dir->i_mutex);
goto done;
}
if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE) && need_reval)
Expand Down

0 comments on commit 37c17e1

Please sign in to comment.