From: Jan Kara <jack@suse.cz>
To: <linux-fsdevel@vger.kernel.org>
Cc: Amir Goldstein <amir73il@gmail.com>, Jan Kara <jack@suse.cz>,
Jakub Acs <acsjakub@amazon.de>
Subject: [PATCH v2 3/3] fsnotify: Shutdown fsnotify before destroying sb's dcache
Date: Tue, 20 Jan 2026 14:23:11 +0100 [thread overview]
Message-ID: <20260120132313.30198-6-jack@suse.cz> (raw)
In-Reply-To: <20260120131830.21836-1-jack@suse.cz>
Currently fsnotify_sb_delete() was called after we have evicted
superblock's dcache and inode cache. This was done mainly so that we
iterate as few inodes as possible when removing inode marks. However, as
Jakub reported, this is problematic because for some filesystems
encoding of file handles uses sb->s_root which gets cleared as part of
dcache eviction. And either delayed fsnotify events or reading fdinfo
for fsnotify group with marks on fs being unmounted may trigger encoding
of file handles during unmount. So move shutdown of fsnotify subsystem
before shrinking of dcache.
Link: https://lore.kernel.org/linux-fsdevel/CAOQ4uxgXvwumYvJm3cLDFfx-TsU3g5-yVsTiG=6i8KS48dn0mQ@mail.gmail.com/
Reported-by: Jakub Acs <acsjakub@amazon.de>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/super.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/super.c b/fs/super.c
index 3d85265d1400..9c13e68277dd 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -618,6 +618,7 @@ void generic_shutdown_super(struct super_block *sb)
const struct super_operations *sop = sb->s_op;
if (sb->s_root) {
+ fsnotify_sb_delete(sb);
shrink_dcache_for_umount(sb);
sync_filesystem(sb);
sb->s_flags &= ~SB_ACTIVE;
@@ -629,9 +630,8 @@ void generic_shutdown_super(struct super_block *sb)
/*
* Clean up and evict any inodes that still have references due
- * to fsnotify or the security policy.
+ * to the security policy.
*/
- fsnotify_sb_delete(sb);
security_sb_delete(sb);
if (sb->s_dio_done_wq) {
--
2.51.0
next prev parent reply other threads:[~2026-01-20 13:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-20 13:23 [PATCH v2 0/3] fsnotify: Independent inode tracking Jan Kara
2026-01-20 13:23 ` [PATCH v2 1/3] fsnotify: Track inode connectors for a superblock Jan Kara
2026-01-20 20:00 ` Amir Goldstein
2026-01-20 13:23 ` [PATCH v2 2/3] fsnotify: Use connector hash for destroying inode marks Jan Kara
2026-01-20 19:58 ` Amir Goldstein
2026-01-21 13:15 ` Jan Kara
2026-01-23 11:22 ` Christian Brauner
2026-01-23 12:31 ` Jan Kara
2026-01-20 13:23 ` Jan Kara [this message]
2026-01-23 11:23 ` [PATCH v2 0/3] fsnotify: Independent inode tracking Christian Brauner
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=20260120132313.30198-6-jack@suse.cz \
--to=jack@suse.cz \
--cc=acsjakub@amazon.de \
--cc=amir73il@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
/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