====================================================== WARNING: possible circular locking dependency detected 6.1.87-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.1/6270 is trying to acquire lock: ffff88814c5a43f8 (&journal->j_checkpoint_mutex){+.+.}-{3:3} , at: __jbd2_log_wait_for_space+0x213/0x760 fs/jbd2/checkpoint.c:71 but task is already holding lock: ffff88814c5a0650 (sb_internal){.+.+}-{0:0}, at: __sb_start_write include/linux/fs.h:1891 [inline] ffff88814c5a0650 (sb_internal){.+.+}-{0:0}, at: sb_start_intwrite include/linux/fs.h:2013 [inline] ffff88814c5a0650 (sb_internal){.+.+}-{0:0}, at: ext4_evict_inode+0x46d/0x1150 fs/ext4/inode.c:240 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (sb_internal){.+.+}-{0:0}: lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662 percpu_down_read+0x44/0x1a0 include/linux/percpu-rwsem.h:51 __sb_start_write include/linux/fs.h:1891 [inline] sb_start_intwrite include/linux/fs.h:2013 [inline] ext4_evict_inode+0x46d/0x1150 fs/ext4/inode.c:240 evict+0x2a4/0x620 fs/inode.c:666 ext4_rename fs/ext4/namei.c:4035 [inline] ext4_rename2+0x3d46/0x4420 fs/ext4/namei.c:4215 vfs_rename+0xd32/0x10f0 fs/namei.c:4876 do_renameat2+0xde0/0x1440 fs/namei.c:5029 __do_sys_renameat2 fs/namei.c:5062 [inline] __se_sys_renameat2 fs/namei.c:5059 [inline] __x64_sys_renameat2+0xce/0xe0 fs/namei.c:5059 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 -> #2 (&sb->s_type->i_mutex_key#8/4){+.+.}-{3:3}: lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662 down_write_nested+0x39/0x60 kernel/locking/rwsem.c:1689 vfs_rename+0x7e4/0x10f0 fs/namei.c:4847 do_renameat2+0xde0/0x1440 fs/namei.c:5029 __do_sys_rename fs/namei.c:5075 [inline] __se_sys_rename fs/namei.c:5073 [inline] __x64_sys_rename+0x82/0x90 fs/namei.c:5073 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 -> #1 (&sb->s_type->i_mutex_key#8){++++}-{3:3}: lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662 down_read+0xad/0xa30 kernel/locking/rwsem.c:1520 inode_lock_shared include/linux/fs.h:768 [inline] ext4_bmap+0x4b/0x410 fs/ext4/inode.c:3176 bmap+0xa1/0xd0 fs/inode.c:1842 jbd2_journal_bmap fs/jbd2/journal.c:977 [inline] __jbd2_journal_erase fs/jbd2/journal.c:1794 [inline] jbd2_journal_flush+0x5b5/0xc40 fs/jbd2/journal.c:2496 ext4_ioctl_checkpoint fs/ext4/ioctl.c:1086 [inline] __ext4_ioctl fs/ext4/ioctl.c:1594 [inline] ext4_ioctl+0x3986/0x5f60 fs/ext4/ioctl.c:1614 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0xf1/0x160 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 -> #0 (&journal->j_checkpoint_mutex){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3090 [inline] check_prevs_add kernel/locking/lockdep.c:3209 [inline] validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662 __mutex_lock_common kernel/locking/mutex.c:603 [inline] mutex_lock_io_nested+0x134/0xab0 kernel/locking/mutex.c:833 __jbd2_log_wait_for_space+0x213/0x760 fs/jbd2/checkpoint.c:71 add_transaction_credits fs/jbd2/transaction.c:298 [inline] start_this_handle+0x1040/0x21b0 fs/jbd2/transaction.c:422 jbd2__journal_start+0x2d1/0x5c0 fs/jbd2/transaction.c:520 __ext4_journal_start_sb+0x19b/0x410 fs/ext4/ext4_jbd2.c:105 __ext4_journal_start fs/ext4/ext4_jbd2.h:326 [inline] ext4_evict_inode+0x8dc/0x1150 fs/ext4/inode.c:251 evict+0x2a4/0x620 fs/inode.c:666 do_unlinkat+0x509/0x820 fs/namei.c:4399 __do_sys_unlink fs/namei.c:4440 [inline] __se_sys_unlink fs/namei.c:4438 [inline] __x64_sys_unlink+0x45/0x50 fs/namei.c:4438 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 other info that might help us debug this: Chain exists of: &journal->j_checkpoint_mutex --> &sb->s_type->i_mutex_key#8/4 --> sb_internal Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(sb_internal); lock(&sb->s_type->i_mutex_key#8/4); lock(sb_internal); lock(&journal->j_checkpoint_mutex); *** DEADLOCK *** 2 locks held by syz-executor.1/6270: #0: ffff88814c5a0460 (sb_writers#4){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:393 #1: ffff88814c5a0650 (sb_internal){.+.+}-{0:0}, at: __sb_start_write include/linux/fs.h:1891 [inline] #1: ffff88814c5a0650 (sb_internal){.+.+}-{0:0}, at: sb_start_intwrite include/linux/fs.h:2013 [inline] #1: ffff88814c5a0650 (sb_internal){.+.+}-{0:0}, at: ext4_evict_inode+0x46d/0x1150 fs/ext4/inode.c:240 stack backtrace: CPU: 0 PID: 6270 Comm: syz-executor.1 Not tainted 6.1.87-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 check_noncircular+0x2fa/0x3b0 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+0x1661/0x5950 kernel/locking/lockdep.c:3825 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662 __mutex_lock_common kernel/locking/mutex.c:603 [inline] mutex_lock_io_nested+0x134/0xab0 kernel/locking/mutex.c:833 __jbd2_log_wait_for_space+0x213/0x760 fs/jbd2/checkpoint.c:71 add_transaction_credits fs/jbd2/transaction.c:298 [inline] start_this_handle+0x1040/0x21b0 fs/jbd2/transaction.c:422 jbd2__journal_start+0x2d1/0x5c0 fs/jbd2/transaction.c:520 __ext4_journal_start_sb+0x19b/0x410 fs/ext4/ext4_jbd2.c:105 __ext4_journal_start fs/ext4/ext4_jbd2.h:326 [inline] ext4_evict_inode+0x8dc/0x1150 fs/ext4/inode.c:251 evict+0x2a4/0x620 fs/inode.c:666 do_unlinkat+0x509/0x820 fs/namei.c:4399 __do_sys_unlink fs/namei.c:4440 [inline] __se_sys_unlink fs/namei.c:4438 [inline] __x64_sys_unlink+0x45/0x50 fs/namei.c:4438 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7fba1327d657 Code: 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 57 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffc635ffc88 EFLAGS: 00000206 ORIG_RAX: 0000000000000057 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fba1327d657 RDX: 00007ffc635ffcb0 RSI: 00007ffc635ffd40 RDI: 00007ffc635ffd40 RBP: 00007ffc635ffd40 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000100 R11: 0000000000000206 R12: 00007ffc63600e00 R13: 00007fba132c93b9 R14: 00000000000445da R15: 0000000000000001 BTRFS info (device loop1): last unmount of filesystem 395ef67a-297e-477c-816d-cd80a5b93e5d XFS (loop1): Unmounting Filesystem