====================================================== WARNING: possible circular locking dependency detected 6.10.0-rc4-syzkaller-00148-g50736169ecc8 #0 Not tainted ------------------------------------------------------ syz-executor.2/5429 is trying to acquire lock: ffff8880269a4ae8 (&sdp->sd_quota_mutex){+.+.}-{3:3}, at: do_qc+0xac/0x5e0 fs/gfs2/quota.c:720 but task is already holding lock: ffff888049489358 (&ip->i_rw_mutex){++++}-{3:3}, at: sweep_bh_for_rgrps fs/gfs2/bmap.c:1529 [inline] ffff888049489358 (&ip->i_rw_mutex){++++}-{3:3}, at: punch_hole+0x1bb6/0x37b0 fs/gfs2/bmap.c:1853 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&ip->i_rw_mutex){++++}-{3:3}: down_read+0x9a/0x330 kernel/locking/rwsem.c:1526 __gfs2_iomap_get+0x146/0x1850 fs/gfs2/bmap.c:859 gfs2_iomap_get+0xb1/0x1f0 fs/gfs2/bmap.c:1413 bh_get+0x25e/0x6e0 fs/gfs2/quota.c:417 qdsb_get.part.0+0x116/0x3e0 fs/gfs2/quota.c:566 qdsb_get fs/gfs2/quota.c:678 [inline] gfs2_quota_hold+0x2be/0x7d0 fs/gfs2/quota.c:646 punch_hole+0xe3c/0x37b0 fs/gfs2/bmap.c:1814 do_shrink fs/gfs2/bmap.c:2034 [inline] gfs2_setattr_size+0x416/0x12f0 fs/gfs2/bmap.c:2150 gfs2_setattr+0x54f/0x910 fs/gfs2/inode.c:2025 notify_change+0x742/0x11f0 fs/attr.c:497 do_truncate+0x15c/0x220 fs/open.c:65 vfs_truncate+0x3ef/0x4e0 fs/open.c:111 do_sys_truncate fs/open.c:134 [inline] __do_sys_truncate fs/open.c:146 [inline] __se_sys_truncate fs/open.c:144 [inline] __x64_sys_truncate+0x177/0x1f0 fs/open.c:144 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&sdp->sd_quota_mutex){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x2478/0x3b30 kernel/locking/lockdep.c:5137 lock_acquire kernel/locking/lockdep.c:5754 [inline] lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5719 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x175/0x9c0 kernel/locking/mutex.c:752 do_qc+0xac/0x5e0 fs/gfs2/quota.c:720 gfs2_quota_change+0x36a/0x550 fs/gfs2/quota.c:1315 punch_hole+0x29c0/0x37b0 fs/gfs2/bmap.c:1954 do_shrink fs/gfs2/bmap.c:2034 [inline] gfs2_setattr_size+0x416/0x12f0 fs/gfs2/bmap.c:2150 gfs2_setattr+0x54f/0x910 fs/gfs2/inode.c:2025 notify_change+0x742/0x11f0 fs/attr.c:497 do_truncate+0x15c/0x220 fs/open.c:65 vfs_truncate+0x3ef/0x4e0 fs/open.c:111 do_sys_truncate fs/open.c:134 [inline] __do_sys_truncate fs/open.c:146 [inline] __se_sys_truncate fs/open.c:144 [inline] __x64_sys_truncate+0x177/0x1f0 fs/open.c:144 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&ip->i_rw_mutex); lock(&sdp->sd_quota_mutex); lock(&ip->i_rw_mutex); lock(&sdp->sd_quota_mutex); *** DEADLOCK *** 5 locks held by syz-executor.2/5429: #0: ffff888045fa8420 (sb_writers#19){.+.+}-{0:0}, at: vfs_truncate+0xea/0x4e0 fs/open.c:84 #1: ffff888049488ec0 (&sb->s_type->i_mutex_key#25){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:791 [inline] #1: ffff888049488ec0 (&sb->s_type->i_mutex_key#25){+.+.}-{3:3}, at: do_truncate+0x14b/0x220 fs/open.c:63 #2: ffff888045fa8610 (sb_internal#3){.+.+}-{0:0}, at: gfs2_trans_begin+0x74/0x100 fs/gfs2/trans.c:118 #3: ffff8880269a5060 (&sdp->sd_log_flush_lock){.+.+}-{3:3}, at: __gfs2_trans_begin+0x533/0xb80 fs/gfs2/trans.c:87 #4: ffff888049489358 (&ip->i_rw_mutex){++++}-{3:3}, at: sweep_bh_for_rgrps fs/gfs2/bmap.c:1529 [inline] #4: ffff888049489358 (&ip->i_rw_mutex){++++}-{3:3}, at: punch_hole+0x1bb6/0x37b0 fs/gfs2/bmap.c:1853 stack backtrace: CPU: 0 PID: 5429 Comm: syz-executor.2 Not tainted 6.10.0-rc4-syzkaller-00148-g50736169ecc8 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114 check_noncircular+0x31a/0x400 kernel/locking/lockdep.c:2187 check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x2478/0x3b30 kernel/locking/lockdep.c:5137 lock_acquire kernel/locking/lockdep.c:5754 [inline] lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5719 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x175/0x9c0 kernel/locking/mutex.c:752 do_qc+0xac/0x5e0 fs/gfs2/quota.c:720 gfs2_quota_change+0x36a/0x550 fs/gfs2/quota.c:1315 punch_hole+0x29c0/0x37b0 fs/gfs2/bmap.c:1954 do_shrink fs/gfs2/bmap.c:2034 [inline] gfs2_setattr_size+0x416/0x12f0 fs/gfs2/bmap.c:2150 gfs2_setattr+0x54f/0x910 fs/gfs2/inode.c:2025 notify_change+0x742/0x11f0 fs/attr.c:497 do_truncate+0x15c/0x220 fs/open.c:65 vfs_truncate+0x3ef/0x4e0 fs/open.c:111 do_sys_truncate fs/open.c:134 [inline] __do_sys_truncate fs/open.c:146 [inline] __se_sys_truncate fs/open.c:144 [inline] __x64_sys_truncate+0x177/0x1f0 fs/open.c:144 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fe02707cee9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fe027e000c8 EFLAGS: 00000246 ORIG_RAX: 000000000000004c RAX: ffffffffffffffda RBX: 00007fe0271abf80 RCX: 00007fe02707cee9 RDX: 0000000000000000 RSI: 0000000000000007 RDI: 0000000020000280 RBP: 00007fe0270c949e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007fe0271abf80 R15: 00007ffce71c1118