From: Jchao Sun <sunjunchao2870@gmail.com>
To: linux-fsdevel@vger.kernel.org
Cc: viro@zeniv.linux.org.uk, jack@suse.cz,
Jchao Sun <sunjunchao2870@gmail.com>
Subject: [PATCH] Add assert for inode->i_io_list in inode_io_list_move_locked.
Date: Tue, 3 May 2022 03:03:07 -0700 [thread overview]
Message-ID: <20220503100307.44303-1-sunjunchao2870@gmail.com> (raw)
Cause of patch b35250c, inode->i_io_list will not only be protected by
wb->list_lock, but also inode->i_lock. And in that patch, Added some assert
for inode->i_lock in some functions except inode_io_list_move_locked.
Should complete it to describe the semantics more clearly. Modified comment
correspondingly.
Signed-off-by: Jchao Sun <sunjunchao2870@gmail.com>
---
fs/fs-writeback.c | 1 +
fs/inode.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 591fe9cf1659..5a761b39f36c 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -120,6 +120,7 @@ static bool inode_io_list_move_locked(struct inode *inode,
struct list_head *head)
{
assert_spin_locked(&wb->list_lock);
+ assert_spin_locked(&inode->i_lock);
list_move(&inode->i_io_list, head);
diff --git a/fs/inode.c b/fs/inode.c
index 9d9b422504d1..bd4da9c5207e 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -27,7 +27,7 @@
* Inode locking rules:
*
* inode->i_lock protects:
- * inode->i_state, inode->i_hash, __iget()
+ * inode->i_state, inode->i_hash, __iget(), inode->i_io_list
* Inode LRU list locks protect:
* inode->i_sb->s_inode_lru, inode->i_lru
* inode->i_sb->s_inode_list_lock protects:
--
2.17.1
next reply other threads:[~2022-05-03 10:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-03 10:03 Jchao Sun [this message]
2022-05-03 17:49 ` [PATCH] Add assert for inode->i_io_list in inode_io_list_move_locked Jan Kara
2022-05-04 7:54 ` [PATCH v2] writeback: Fix inode->i_io_list not be protected by inode->i_lock error Jchao Sun
2022-05-04 14:39 ` Jan Kara
2022-05-04 18:25 ` [PATCH v3] " Jchao Sun
2022-05-04 19:38 ` Jan Kara
2022-05-05 5:01 ` Jchao sun
[not found] ` <CAHB1Naif38Cib5xMLa1nK7-5H4FeLgPMLbBCi-Ze=YNna8ymYA@mail.gmail.com>
2022-05-05 9:00 ` Jan Kara
2022-05-06 16:04 ` Jchao sun
2022-05-09 13:40 ` Jan Kara
2022-05-04 3:12 ` [Add assert for inode] 38923ae236: kernel_BUG_at_fs/fs-writeback.c kernel test robot
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=20220503100307.44303-1-sunjunchao2870@gmail.com \
--to=sunjunchao2870@gmail.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).