[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211207101646.401982-1-lv.ruyi@zte.com.cn>
Date: Tue, 7 Dec 2021 10:16:46 +0000
From: cgel.zte@...il.com
To: viro@...iv.linux.org.uk
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
Lv Ruyi <lv.ruyi@....com.cn>, Zeal Robot <zealci@....com.cn>
Subject: [PATCH] fs/dcache: prevent repeated locking
From: Lv Ruyi <lv.ruyi@....com.cn>
Move the spin_lock above the restart to prevent to lock twice
when the code goto restart.
Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@....com.cn>
---
fs/dcache.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/dcache.c b/fs/dcache.c
index c84269c6e8bf..8580d51b397a 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1102,8 +1102,8 @@ struct dentry *d_find_alias_rcu(struct inode *inode)
void d_prune_aliases(struct inode *inode)
{
struct dentry *dentry;
-restart:
spin_lock(&inode->i_lock);
+restart:
hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) {
spin_lock(&dentry->d_lock);
if (!dentry->d_lockref.count) {
--
2.25.1
Powered by blists - more mailing lists