From: cgel.zte@gmail.com
To: viro@zeniv.linux.org.uk
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Lv Ruyi <lv.ruyi@zte.com.cn>, Zeal Robot <zealci@zte.com.cn>
Subject: [PATCH] fs/dcache: prevent repeated locking
Date: Tue, 7 Dec 2021 10:16:46 +0000 [thread overview]
Message-ID: <20211207101646.401982-1-lv.ruyi@zte.com.cn> (raw)
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
next reply other threads:[~2021-12-07 10:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-07 10:16 cgel.zte [this message]
2021-12-07 13:17 ` Matthew Wilcox
2021-12-07 21:25 ` Eric Biggers
2021-12-07 22:11 ` Matthew Wilcox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211207101646.401982-1-lv.ruyi@zte.com.cn \
--to=cgel.zte@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lv.ruyi@zte.com.cn \
--cc=viro@zeniv.linux.org.uk \
--cc=zealci@zte.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®