syzbot


possible deadlock in ext4_destroy_inline_data

Status: upstream: reported on 2025/11/09 09:23
Reported-by: syzbot+ed8bb2474e55e323a784@syzkaller.appspotmail.com
First crash: 5d16h, last: 3d14h
Similar bugs (4)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 possible deadlock in ext4_destroy_inline_data 4 5 4d21h 7d23h 0/3 upstream: reported on 2025/11/07 02:20
upstream possible deadlock in ext4_destroy_inline_data (2) ext4 4 52 11h32m 9d03h 0/29 upstream: reported on 2025/11/05 22:08
upstream possible deadlock in ext4_destroy_inline_data ext4 4 1 334d 330d 0/29 auto-obsoleted due to no activity on 2025/03/25 12:07
linux-6.6 possible deadlock in ext4_destroy_inline_data 4 9 4h05m 13d 0/2 upstream: reported on 2025/11/01 09:40

Sample crash report:
loop2: detected capacity change from 0 to 2048
EXT4-fs (loop2): mounted filesystem without journal. Quota mode: none.
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.2.196/4971 is trying to acquire lock:
ffff88805408e518 (&ei->xattr_sem){++++}-{3:3}, at: ext4_write_lock_xattr fs/ext4/xattr.h:155 [inline]
ffff88805408e518 (&ei->xattr_sem){++++}-{3:3}, at: ext4_destroy_inline_data+0x24/0xe0 fs/ext4/inline.c:1912

but task is already holding lock:
ffff888028520b98 (&sbi->s_writepages_rwsem){.+.+}-{0:0}, at: ext4_writepages+0x1c0/0x2e50 fs/ext4/inode.c:2715

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&sbi->s_writepages_rwsem){.+.+}-{0:0}:
       percpu_down_read+0x44/0x1a0 include/linux/percpu-rwsem.h:51
       ext4_writepages+0x1c0/0x2e50 fs/ext4/inode.c:2715
       do_writepages+0x3b7/0x610 mm/page-writeback.c:2491
       __writeback_single_inode+0x156/0x1160 fs/fs-writeback.c:1622
       writeback_single_inode+0x221/0x8b0 fs/fs-writeback.c:1743
       write_inode_now+0x15d/0x1d0 fs/fs-writeback.c:2780
       iput_final fs/inode.c:1821 [inline]
       iput+0x613/0x980 fs/inode.c:1860
       ext4_xattr_block_set+0x2736/0x32a0 fs/ext4/xattr.c:2158
       ext4_xattr_move_to_block fs/ext4/xattr.c:2626 [inline]
       ext4_xattr_make_inode_space fs/ext4/xattr.c:2701 [inline]
       ext4_expand_extra_isize_ea+0x109b/0x19b0 fs/ext4/xattr.c:2793
       __ext4_expand_extra_isize+0x301/0x3e0 fs/ext4/inode.c:5980
       ext4_try_to_expand_extra_isize fs/ext4/inode.c:6023 [inline]
       __ext4_mark_inode_dirty+0x47f/0x770 fs/ext4/inode.c:6101
       ext4_evict_inode+0xa73/0x1100 fs/ext4/inode.c:279
       evict+0x485/0x870 fs/inode.c:705
       ext4_orphan_cleanup+0xbd3/0x1400 fs/ext4/orphan.c:470
       __ext4_fill_super fs/ext4/super.c:5530 [inline]
       ext4_fill_super+0x7bdf/0x8150 fs/ext4/super.c:5661
       get_tree_bdev+0x3f1/0x610 fs/super.c:1366
       vfs_get_tree+0x88/0x270 fs/super.c:1573
       do_new_mount+0x24a/0xa40 fs/namespace.c:3078
       do_mount fs/namespace.c:3421 [inline]
       __do_sys_mount fs/namespace.c:3629 [inline]
       __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3606
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (&ei->xattr_sem){++++}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3090 [inline]
       check_prevs_add kernel/locking/lockdep.c:3209 [inline]
       validate_chain kernel/locking/lockdep.c:3825 [inline]
       __lock_acquire+0x2cf8/0x7c50 kernel/locking/lockdep.c:5049
       lock_acquire+0x1b4/0x490 kernel/locking/lockdep.c:5662
       down_write+0x36/0x60 kernel/locking/rwsem.c:1573
       ext4_write_lock_xattr fs/ext4/xattr.h:155 [inline]
       ext4_destroy_inline_data+0x24/0xe0 fs/ext4/inline.c:1912
       ext4_writepages+0x5df/0x2e50 fs/ext4/inode.c:2761
       do_writepages+0x3b7/0x610 mm/page-writeback.c:2491
       filemap_fdatawrite_wbc+0x11e/0x180 mm/filemap.c:388
       __filemap_fdatawrite_range mm/filemap.c:421 [inline]
       file_write_and_wait_range+0x137/0x200 mm/filemap.c:774
       ext4_sync_file+0x23b/0xca0 fs/ext4/fsync.c:151
       generic_write_sync include/linux/fs.h:2962 [inline]
       ext4_buffered_write_iter+0x347/0x3e0 fs/ext4/file.c:292
       ext4_file_write_iter+0x1d6/0x16e0 fs/ext4/file.c:-1
       do_iter_readv_writev fs/read_write.c:-1 [inline]
       do_iter_write+0x62d/0xaf0 fs/read_write.c:861
       vfs_writev fs/read_write.c:934 [inline]
       do_pwritev+0x201/0x340 fs/read_write.c:1031
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&sbi->s_writepages_rwsem);
                               lock(&ei->xattr_sem);
                               lock(&sbi->s_writepages_rwsem);
  lock(&ei->xattr_sem);

 *** DEADLOCK ***

2 locks held by syz.2.196/4971:
 #0: ffff888056fae460 (sb_writers#4){.+.+}-{0:0}, at: vfs_writev fs/read_write.c:933 [inline]
 #0: ffff888056fae460 (sb_writers#4){.+.+}-{0:0}, at: do_pwritev+0x1ef/0x340 fs/read_write.c:1031
 #1: ffff888028520b98 (&sbi->s_writepages_rwsem){.+.+}-{0:0}, at: ext4_writepages+0x1c0/0x2e50 fs/ext4/inode.c:2715

stack backtrace:
CPU: 1 PID: 4971 Comm: syz.2.196 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x168/0x22e lib/dump_stack.c:106
 check_noncircular+0x274/0x310 kernel/locking/lockdep.c:2170
 check_prev_add kernel/locking/lockdep.c:3090 [inline]
 check_prevs_add kernel/locking/lockdep.c:3209 [inline]
 validate_chain kernel/locking/lockdep.c:3825 [inline]
 __lock_acquire+0x2cf8/0x7c50 kernel/locking/lockdep.c:5049
 lock_acquire+0x1b4/0x490 kernel/locking/lockdep.c:5662
 down_write+0x36/0x60 kernel/locking/rwsem.c:1573
 ext4_write_lock_xattr fs/ext4/xattr.h:155 [inline]
 ext4_destroy_inline_data+0x24/0xe0 fs/ext4/inline.c:1912
 ext4_writepages+0x5df/0x2e50 fs/ext4/inode.c:2761
 do_writepages+0x3b7/0x610 mm/page-writeback.c:2491
 filemap_fdatawrite_wbc+0x11e/0x180 mm/filemap.c:388
 __filemap_fdatawrite_range mm/filemap.c:421 [inline]
 file_write_and_wait_range+0x137/0x200 mm/filemap.c:774
 ext4_sync_file+0x23b/0xca0 fs/ext4/fsync.c:151
 generic_write_sync include/linux/fs.h:2962 [inline]
 ext4_buffered_write_iter+0x347/0x3e0 fs/ext4/file.c:292
 ext4_file_write_iter+0x1d6/0x16e0 fs/ext4/file.c:-1
 do_iter_readv_writev fs/read_write.c:-1 [inline]
 do_iter_write+0x62d/0xaf0 fs/read_write.c:861
 vfs_writev fs/read_write.c:934 [inline]
 do_pwritev+0x201/0x340 fs/read_write.c:1031
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fde9fd8f6c9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fdea0b7c038 EFLAGS: 00000246 ORIG_RAX: 0000000000000148
RAX: ffffffffffffffda RBX: 00007fde9ffe5fa0 RCX: 00007fde9fd8f6c9
RDX: 0000000000000001 RSI: 0000200000000100 RDI: 0000000000000004
RBP: 00007fde9fe11f91 R08: 0000000000000000 R09: 0000000000000014
R10: 0000000000005405 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fde9ffe6038 R14: 00007fde9ffe5fa0 R15: 00007ffdd29ff798
 </TASK>
EXT4-fs error (device loop2): ext4_mb_generate_buddy:1097: group 0, block bitmap and bg descriptor inconsistent: 0 vs 150994969 free clusters
EXT4-fs (loop2): Delayed block allocation failed for inode 15 at logical offset 0 with max blocks 1 with error 28
EXT4-fs (loop2): This should not happen!! Data will be lost

EXT4-fs (loop2): Total free blocks count 0
EXT4-fs (loop2): Free/Dirty block details
EXT4-fs (loop2): free_blocks=2415919504
EXT4-fs (loop2): dirty_blocks=16
EXT4-fs (loop2): Block reservation details
EXT4-fs (loop2): i_reserved_data_blocks=1

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/11/11 10:54 linux-6.1.y f6e38ae624cf 4e1406b4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ext4_destroy_inline_data
2025/11/09 09:22 linux-6.1.y f6e38ae624cf 4e1406b4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ext4_destroy_inline_data
* Struck through repros no longer work on HEAD.