lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 26 Sep 2007 04:04:30 +0800
From:	Denis Cheng <crquan@...il.com>
To:	Alexander Viro <viro@...iv.linux.org.uk>
Cc:	linux-kernel@...r.kernel.org, cr_quan@....com
Subject: [PATCH] fs/dcache.c: revamped to use a more straightforward and efficient way to operate

Signed-off-by: Denis Cheng <crquan@...il.com>
---
 fs/dcache.c |   39 ++++++++++++++++++---------------------
 1 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/fs/dcache.c b/fs/dcache.c
index 678d39d..05ed44a 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1138,29 +1138,26 @@ struct dentry * d_alloc_anon(struct inode *inode)
 	
 	spin_lock(&dcache_lock);
 	res = __d_find_alias(inode, 0);
-	if (!res) {
-		/* attach a disconnected dentry */
-		res = tmp;
-		tmp = NULL;
-		spin_lock(&res->d_lock);
-		res->d_sb = inode->i_sb;
-		res->d_parent = res;
-		res->d_inode = inode;
-		res->d_flags |= DCACHE_DISCONNECTED;
-		res->d_flags &= ~DCACHE_UNHASHED;
-		list_add(&res->d_alias, &inode->i_dentry);
-		hlist_add_head(&res->d_hash, &inode->i_sb->s_anon);
-		spin_unlock(&res->d_lock);
-
-		inode = NULL; /* don't drop reference */
-	}
-	spin_unlock(&dcache_lock);
-
-	if (inode)
+	if (unlikely(res)) {
+		spin_unlock(&dcache_lock);
 		iput(inode);
-	if (tmp)
 		dput(tmp);
-	return res;
+		return res;
+	} else {
+		/* attach a disconnected dentry */
+		spin_lock(&tmp->d_lock);
+		tmp->d_sb = inode->i_sb;
+		tmp->d_parent = tmp;
+		tmp->d_inode = inode;
+		tmp->d_flags |= DCACHE_DISCONNECTED;
+		tmp->d_flags &= ~DCACHE_UNHASHED;
+		list_add(&tmp->d_alias, &inode->i_dentry);
+		hlist_add_head(&tmp->d_hash, &inode->i_sb->s_anon);
+		spin_unlock(&tmp->d_lock);
+
+		spin_unlock(&dcache_lock);
+		return tmp;
+	}
 }
 
 
-- 
1.5.3.2

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ