Messages in this thread Patch in this message | | | From | cgel.zte@gmail ... | Subject | [PATCH] fs/dcache: prevent repeated locking | Date | Tue, 7 Dec 2021 10:16:46 +0000 |
| |
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
| |