====================================================== WARNING: possible circular locking dependency detected 6.2.0-next-20230224 #1 Not tainted ------------------------------------------------------ syz-executor.0/270 is trying to acquire lock: ffff8880100043f8 (&journal->j_checkpoint_mutex){+.+.}-{3:3}, at: __jbd2_log_wait_for_space+0x238/0x4b0 but task is already holding lock: ffff888040735380 (&sb->s_type->i_mutex_key#6){++++}-{3:3}, at: vfs_unlink+0xd9/0x930 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&sb->s_type->i_mutex_key#6){++++}-{3:3}: down_read+0x3d/0x50 ext4_bmap+0x52/0x470 bmap+0xb0/0x130 jbd2_journal_bmap+0xac/0x1d0 jbd2_journal_flush+0x87f/0xc90 __ext4_ioctl+0x9fd/0x4330 __x64_sys_ioctl+0x19e/0x210 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc -> #0 (&journal->j_checkpoint_mutex){+.+.}-{3:3}: __lock_acquire+0x2d56/0x6380 lock_acquire.part.0+0xea/0x320 mutex_lock_io_nested+0x149/0x1300 __jbd2_log_wait_for_space+0x238/0x4b0 add_transaction_credits+0xa42/0xb80 start_this_handle+0x3a6/0x14d0 jbd2__journal_start+0x394/0x6b0 __ext4_journal_start_sb+0x4c2/0x6f0 __ext4_unlink+0x44e/0xcf0 ext4_unlink+0x3ac/0x640 vfs_unlink+0x35e/0x930 do_unlinkat+0x3b9/0x650 __x64_sys_unlink+0xca/0x110 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&sb->s_type->i_mutex_key#6); lock(&journal->j_checkpoint_mutex); lock(&sb->s_type->i_mutex_key#6); lock(&journal->j_checkpoint_mutex); *** DEADLOCK *** 3 locks held by syz-executor.0/270: #0: ffff888010000438 (sb_writers#3){.+.+}-{0:0}, at: do_unlinkat+0x190/0x650 #1: ffff8880404e97e0 (&type->i_mutex_dir_key#3/1){+.+.}-{3:3}, at: do_unlinkat+0x280/0x650 #2: ffff888040735380 (&sb->s_type->i_mutex_key#6){++++}-{3:3}, at: vfs_unlink+0xd9/0x930 stack backtrace: CPU: 0 PID: 270 Comm: syz-executor.0 Not tainted 6.2.0-next-20230224 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 Call Trace: dump_stack_lvl+0x91/0xf0 check_noncircular+0x263/0x2e0 __lock_acquire+0x2d56/0x6380 lock_acquire.part.0+0xea/0x320 mutex_lock_io_nested+0x149/0x1300 __jbd2_log_wait_for_space+0x238/0x4b0 add_transaction_credits+0xa42/0xb80 start_this_handle+0x3a6/0x14d0 jbd2__journal_start+0x394/0x6b0 __ext4_journal_start_sb+0x4c2/0x6f0 __ext4_unlink+0x44e/0xcf0 ext4_unlink+0x3ac/0x640 vfs_unlink+0x35e/0x930 do_unlinkat+0x3b9/0x650 __x64_sys_unlink+0xca/0x110 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc RIP: 0033:0x7ff8527ae457 Code: 73 01 c3 48 c7 c1 bc 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 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fff9bbfa548 EFLAGS: 00000206 ORIG_RAX: 0000000000000057 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007ff8527ae457 RDX: 00007fff9bbfa580 RSI: 00007fff9bbfa580 RDI: 00007fff9bbfa610 RBP: 00007fff9bbfa610 R08: 0000000000000001 R09: 00007fff9bbfa3e0 R10: 0000555557350cdb R11: 0000000000000206 R12: 00007ff852808105 R13: 00007fff9bbfb6d0 R14: 0000555557350c20 R15: 00007fff9bbfb710 netlink: 12 bytes leftover after parsing attributes in process `syz-executor.3'. audit: type=1326 audit(1677237442.903:20): auid=0 uid=0 gid=0 ses=4 subj=system_u:system_r:kernel_t:s0 pid=14457 comm="syz-executor.7" exe="/syz-executor.7" sig=31 arch=c000003e syscall=202 compat=0 ip=0x7f77b7ea9b19 code=0x0 audit: type=1326 audit(1677237443.726:21): auid=0 uid=0 gid=0 ses=4 subj=system_u:system_r:kernel_t:s0 pid=14508 comm="syz-executor.7" exe="/syz-executor.7" sig=31 arch=c000003e syscall=202 compat=0 ip=0x7f77b7ea9b19 code=0x0 audit: type=1326 audit(1677237444.900:22): auid=0 uid=0 gid=0 ses=4 subj=system_u:system_r:kernel_t:s0 pid=14550 comm="syz-executor.7" exe="/syz-executor.7" sig=31 arch=c000003e syscall=202 compat=0 ip=0x7f77b7ea9b19 code=0x0 audit: type=1326 audit(1677237446.424:23): auid=0 uid=0 gid=0 ses=4 subj=system_u:system_r:kernel_t:s0 pid=14581 comm="syz-executor.7" exe="/syz-executor.7" sig=31 arch=c000003e syscall=202 compat=0 ip=0x7f77b7ea9b19 code=0x0 loop1: detected capacity change from 0 to 40 syz-executor.1: attempt to access beyond end of device loop1: rw=2049, sector=124, nr_sectors = 4 limit=40 buffer_io_error: 126 callbacks suppressed Buffer I/O error on dev loop1, logical block 31, lost async page write loop1: detected capacity change from 0 to 40 syz-executor.1: attempt to access beyond end of device loop1: rw=2049, sector=124, nr_sectors = 4 limit=40 Buffer I/O error on dev loop1, logical block 31, lost async page write loop1: detected capacity change from 0 to 40 syz-executor.1: attempt to access beyond end of device loop1: rw=2049, sector=124, nr_sectors = 4 limit=40 Buffer I/O error on dev loop1, logical block 31, lost async page write