lkml.org 
[lkml]   [2021]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] fs/dcache: prevent repeated locking
Date
From: Lv Ruyi <lv.ruyi@zte.com.cn>

Move the spin_lock above the restart to prevent to lock twice
when the code goto restart.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.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
\
 
 \ /
  Last update: 2021-12-07 11:17    [W:0.093 / U:0.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site