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

List:       git-commits-head
Subject:    vfs: fix d_need_lookup/d_revalidate order in do_lookup
From:       "Linux Kernel Mailing List" <linux-kernel () vger ! kernel ! org>
Date:       2012-03-31 21:21:05
Message-ID: 20120331212105.BDA077C00D5 () ra ! kernel ! org
[Download RAW message or body]

Gitweb:     http://git.kernel.org/linus/;a=commit;h=fa4ee159512ee39b6c65ac40db986ea7a2f7de60
Commit:     fa4ee159512ee39b6c65ac40db986ea7a2f7de60
Parent:     4613ad180d19082f99551477dcb13cb23d23661b
Author:     Miklos Szeredi <mszeredi@suse.cz>
AuthorDate: Mon Mar 26 12:54:19 2012 +0200
Committer:  Al Viro <viro@zeniv.linux.org.uk>
CommitDate: Sat Mar 31 16:03:16 2012 -0400

    vfs: fix d_need_lookup/d_revalidate order in do_lookup
    
    Doing revalidate on a dentry which has not yet been looked up makes no sense.
    
    Move the d_need_lookup() check before d_revalidate().
    
    Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 fs/namei.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index e615ff3..768f236 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1139,6 +1139,8 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
 			return -ECHILD;
 		nd->seq = seq;
 
+		if (unlikely(d_need_lookup(dentry)))
+			goto unlazy;
 		if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) {
 			status = d_revalidate(dentry, nd);
 			if (unlikely(status <= 0)) {
@@ -1147,8 +1149,6 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
 				goto unlazy;
 			}
 		}
-		if (unlikely(d_need_lookup(dentry)))
-			goto unlazy;
 		path->mnt = mnt;
 		path->dentry = dentry;
 		if (unlikely(!__follow_mount_rcu(nd, path, inode)))
--
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