]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ext4: Sync and invalidate metadata buffers from ext4_evict_inode()
authorJan Kara <jack@suse.cz>
Thu, 26 Mar 2026 09:54:13 +0000 (10:54 +0100)
committerChristian Brauner <brauner@kernel.org>
Thu, 26 Mar 2026 14:03:29 +0000 (15:03 +0100)
There are only very few filesystems using generic metadata buffer head
tracking and everybody is paying the overhead. When we remove this
tracking for inode reclaim code .evict will start to see inodes with
metadata buffers attached so write them out and prune them.

Acked-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20260326095354.16340-61-jack@suse.cz
Tested-by: syzbot@syzkaller.appspotmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/ext4/inode.c
fs/ext4/super.c

index d18d94acddcc16971946a9cfecc69cc83f1dbdf2..6f892abef003c1d22ba539682a4bfd964e6b0196 100644 (file)
@@ -185,7 +185,9 @@ void ext4_evict_inode(struct inode *inode)
                ext4_evict_ea_inode(inode);
        if (inode->i_nlink) {
                truncate_inode_pages_final(&inode->i_data);
-
+               /* Avoid mballoc special inode which has no proper iops */
+               if (!EXT4_SB(inode->i_sb)->s_journal)
+                       sync_mapping_buffers(&inode->i_data);
                goto no_delete;
        }
 
index 43f680c750ae6b2cacb35bcaad262ba234676ef4..ea827b0ecc8dc5403d9f27ce6e279eef5e16aac4 100644 (file)
@@ -1524,7 +1524,8 @@ static void destroy_inodecache(void)
 void ext4_clear_inode(struct inode *inode)
 {
        ext4_fc_del(inode);
-       invalidate_inode_buffers(inode);
+       if (!EXT4_SB(inode->i_sb)->s_journal)
+               invalidate_inode_buffers(inode);
        clear_inode(inode);
        ext4_discard_preallocations(inode);
        ext4_es_remove_extent(inode, 0, EXT_MAX_BLOCKS);