====================================================== WARNING: possible circular locking dependency detected 6.10.0-rc5-next-20240624-syzkaller #0 Not tainted ------------------------------------------------------ syz.0.480/6834 is trying to acquire lock: ffff888078f0caf0 (&sdp->sd_quota_mutex){+.+.}-{3:3}, at: do_qc+0xaa/0x670 fs/gfs2/quota.c:720 but task is already holding lock: ffff88805e745620 (&ip->i_rw_mutex){++++}-{3:3}, at: sweep_bh_for_rgrps fs/gfs2/bmap.c:1529 [inline] ffff88805e745620 (&ip->i_rw_mutex){++++}-{3:3}, at: punch_hole+0x271c/0x39f0 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}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5816 down_read+0xb1/0xa40 kernel/locking/rwsem.c:1526 __gfs2_iomap_get+0x17e/0x1480 fs/gfs2/bmap.c:859 gfs2_iomap_get+0xdf/0x160 fs/gfs2/bmap.c:1413 bh_get+0x26a/0x7e0 fs/gfs2/quota.c:417 qdsb_get+0x218/0x340 fs/gfs2/quota.c:566 gfs2_quota_hold+0x1a1/0x5d0 fs/gfs2/quota.c:646 punch_hole+0xe9d/0x39f0 fs/gfs2/bmap.c:1814 __gfs2_punch_hole+0x87f/0xb30 fs/gfs2/bmap.c:2460 gfs2_fallocate+0x3a4/0x490 fs/gfs2/file.c:1399 vfs_fallocate+0x553/0x6c0 fs/open.c:334 madvise_remove mm/madvise.c:1012 [inline] madvise_vma_behavior mm/madvise.c:1036 [inline] madvise_walk_vmas mm/madvise.c:1268 [inline] do_madvise+0x1d0e/0x4590 mm/madvise.c:1464 __do_sys_madvise mm/madvise.c:1481 [inline] __se_sys_madvise mm/madvise.c:1479 [inline] __x64_sys_madvise+0xa6/0xc0 mm/madvise.c:1479 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 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:3158 [inline] check_prevs_add kernel/locking/lockdep.c:3277 [inline] validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3901 __lock_acquire+0x1359/0x2000 kernel/locking/lockdep.c:5193 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5816 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 do_qc+0xaa/0x670 fs/gfs2/quota.c:720 gfs2_quota_change+0x2e2/0x8d0 fs/gfs2/quota.c:1315 punch_hole+0x3370/0x39f0 fs/gfs2/bmap.c:1954 __gfs2_punch_hole+0x87f/0xb30 fs/gfs2/bmap.c:2460 gfs2_fallocate+0x3a4/0x490 fs/gfs2/file.c:1399 vfs_fallocate+0x553/0x6c0 fs/open.c:334 madvise_remove mm/madvise.c:1012 [inline] madvise_vma_behavior mm/madvise.c:1036 [inline] madvise_walk_vmas mm/madvise.c:1268 [inline] do_madvise+0x1d0e/0x4590 mm/madvise.c:1464 __do_sys_madvise mm/madvise.c:1481 [inline] __se_sys_madvise mm/madvise.c:1479 [inline] __x64_sys_madvise+0xa6/0xc0 mm/madvise.c:1479 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 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.0.480/6834: #0: ffff88805566e420 (sb_writers#17){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2876 [inline] #0: ffff88805566e420 (sb_writers#17){.+.+}-{0:0}, at: vfs_fallocate+0x4ea/0x6c0 fs/open.c:333 #1: ffff88805e745188 (&sb->s_type->i_mutex_key#25){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:799 [inline] #1: ffff88805e745188 (&sb->s_type->i_mutex_key#25){+.+.}-{3:3}, at: gfs2_fallocate+0x19f/0x490 fs/gfs2/file.c:1380 #2: ffff88805566e610 (sb_internal#3){.+.+}-{0:0}, at: gfs2_trans_begin+0x71/0xe0 fs/gfs2/trans.c:118 #3: ffff888078f0d068 (&sdp->sd_log_flush_lock){++++}-{3:3}, at: __gfs2_trans_begin+0x55d/0x950 fs/gfs2/trans.c:87 #4: ffff88805e745620 (&ip->i_rw_mutex){++++}-{3:3}, at: sweep_bh_for_rgrps fs/gfs2/bmap.c:1529 [inline] #4: ffff88805e745620 (&ip->i_rw_mutex){++++}-{3:3}, at: punch_hole+0x271c/0x39f0 fs/gfs2/bmap.c:1853 stack backtrace: CPU: 1 UID: 0 PID: 6834 Comm: syz.0.480 Not tainted 6.10.0-rc5-next-20240624-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_circular_bug+0x13a/0x1b0 kernel/locking/lockdep.c:2074 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2203 check_prev_add kernel/locking/lockdep.c:3158 [inline] check_prevs_add kernel/locking/lockdep.c:3277 [inline] validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3901 __lock_acquire+0x1359/0x2000 kernel/locking/lockdep.c:5193 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5816 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 do_qc+0xaa/0x670 fs/gfs2/quota.c:720 gfs2_quota_change+0x2e2/0x8d0 fs/gfs2/quota.c:1315 punch_hole+0x3370/0x39f0 fs/gfs2/bmap.c:1954 __gfs2_punch_hole+0x87f/0xb30 fs/gfs2/bmap.c:2460 gfs2_fallocate+0x3a4/0x490 fs/gfs2/file.c:1399 vfs_fallocate+0x553/0x6c0 fs/open.c:334 madvise_remove mm/madvise.c:1012 [inline] madvise_vma_behavior mm/madvise.c:1036 [inline] madvise_walk_vmas mm/madvise.c:1268 [inline] do_madvise+0x1d0e/0x4590 mm/madvise.c:1464 __do_sys_madvise mm/madvise.c:1481 [inline] __se_sys_madvise mm/madvise.c:1479 [inline] __x64_sys_madvise+0xa6/0xc0 mm/madvise.c:1479 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f6e11f75ae9 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:00007f6e119ff048 EFLAGS: 00000246 ORIG_RAX: 000000000000001c RAX: ffffffffffffffda RBX: 00007f6e12103fa0 RCX: 00007f6e11f75ae9 RDX: 0000000000000009 RSI: 000000000060000b RDI: 0000000020000000 RBP: 00007f6e11ff6756 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f6e12103fa0 R15: 00007ffc536abaa8