[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    untangling do_lookup() - merge failure exits in !dentry case
From:       "Linux Kernel Mailing List" <linux-kernel () vger ! kernel ! org>
Date:       2012-03-31 21:21:05
Message-ID: 20120331212105.EB0F37C00DC () ra ! kernel ! org
[Download RAW message or body]

Gitweb:     http://git.kernel.org/linus/;a=commit;h=ec335e91a4f088d8759c1311d0724e609d1c318e
Commit:     ec335e91a4f088d8759c1311d0724e609d1c318e
Parent:     d774a058d94d6b0dafada2295ec5221481b07d16
Author:     Al Viro <viro@zeniv.linux.org.uk>
AuthorDate: Fri Mar 30 14:37:42 2012 -0400
Committer:  Al Viro <viro@zeniv.linux.org.uk>
CommitDate: Sat Mar 31 16:03:16 2012 -0400

    untangling do_lookup() - merge failure exits in !dentry case
    
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 fs/namei.c |   23 ++++++++---------------
 1 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 5414438..a0f9a02 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1176,35 +1176,28 @@ retry:
 		dentry = d_lookup(parent, name);
 		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);
-			}
-		} else if (dentry && (dentry->d_flags & DCACHE_OP_REVALIDATE)) {
+			goto l;
+		}
+		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;
+					dentry = ERR_PTR(status);
+					goto l;
 				}
 				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);
-			}
 		}
+	l:
 		mutex_unlock(&dir->i_mutex);
+		if (IS_ERR(dentry))
+			return PTR_ERR(dentry);
 		goto done;
 	}
 	if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE) && need_reval)
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic