summaryrefslogtreecommitdiff
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-03-30 14:34:00 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-03-31 16:03:16 -0400
commitd774a058d94d6b0dafada2295ec5221481b07d16 (patch)
tree952afb38f52c989752812dc3c0970259293211a9 /fs/namei.c
parent08b0ab7c20f767187ae635d51bdd9d262ebe8357 (diff)
untangling do_lookup() - massage !dentry case towards __lookup_hash()
Reorder if-else cases for starters... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c45
1 files changed, 20 insertions, 25 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 14bb00a9fa9a..5414438abff0 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1174,39 +1174,34 @@ retry:
mutex_lock(&dir->i_mutex);
dentry = d_lookup(parent, name);
- if (likely(!dentry)) {
- dentry = d_alloc_and_lookup(parent, name, nd);
- if (IS_ERR(dentry)) {
- mutex_unlock(&dir->i_mutex);
- return PTR_ERR(dentry);
- }
- /* known good */
- status = 1;
- } else if (unlikely(d_need_lookup(dentry))) {
+ if (dentry && d_need_lookup(dentry)) {
dentry = d_inode_lookup(parent, dentry, nd);
if (IS_ERR(dentry)) {
mutex_unlock(&dir->i_mutex);
return PTR_ERR(dentry);
}
- /* known good */
- status = 1;
- } else if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE))
+ } else if (dentry && (dentry->d_flags & DCACHE_OP_REVALIDATE)) {
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 = d_alloc_and_lookup(parent, name, nd);
- if (IS_ERR(dentry)) {
+ if (unlikely(status <= 0)) {
+ if (status < 0) {
mutex_unlock(&dir->i_mutex);
- return PTR_ERR(dentry);
+ dput(dentry);
+ return status;
}
- /* known good */
- status = 1;
+ if (!d_invalidate(dentry)) {
+ dput(dentry);
+ dentry = d_alloc_and_lookup(parent, name, nd);
+ if (IS_ERR(dentry)) {
+ mutex_unlock(&dir->i_mutex);
+ return PTR_ERR(dentry);
+ }
+ }
+ }
+ } else if (!dentry) {
+ dentry = d_alloc_and_lookup(parent, name, nd);
+ if (IS_ERR(dentry)) {
+ mutex_unlock(&dir->i_mutex);
+ return PTR_ERR(dentry);
}
}
mutex_unlock(&dir->i_mutex);