From 8a682ae4d58ca51e0ef9226046fdfb2cc476aa53 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 30 Mar 2012 14:34:00 -0400 Subject: [PATCH] --- yaml --- r: 298375 b: refs/heads/master c: d774a058d94d6b0dafada2295ec5221481b07d16 h: refs/heads/master i: 298373: a5a3b478a36f831153bce6ee875d1d306a481174 298371: c1a8887d81590ff113be93e0e37ba4a6c826aa92 298367: 82e8cc85497ba395c7e5dc47a739cad9e4ecffc3 v: v3 --- [refs] | 2 +- trunk/fs/namei.c | 45 ++++++++++++++++++++------------------------- 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/[refs] b/[refs] index 0e0c95285256..17a384c4df5f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 08b0ab7c20f767187ae635d51bdd9d262ebe8357 +refs/heads/master: d774a058d94d6b0dafada2295ec5221481b07d16 diff --git a/trunk/fs/namei.c b/trunk/fs/namei.c index 14bb00a9fa9a..5414438abff0 100644 --- a/trunk/fs/namei.c +++ b/trunk/fs/namei.c @@ -1174,39 +1174,34 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, 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);