====================================================== WARNING: possible circular locking dependency detected 6.1.115-syzkaller #0 Not tainted ------------------------------------------------------ syz.1.321/5633 is trying to acquire lock: ffff0000cf63cae0 (&sdp->sd_quota_mutex){+.+.}-{3:3}, at: do_qc+0xbc/0x664 fs/gfs2/quota.c:682 but task is already holding lock: ffff0000f22c20c8 (&ip->i_rw_mutex){++++}-{3:3}, at: sweep_bh_for_rgrps fs/gfs2/bmap.c:1512 [inline] ffff0000f22c20c8 (&ip->i_rw_mutex){++++}-{3:3}, at: punch_hole+0x1fb0/0x2fe8 fs/gfs2/bmap.c:1837 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+0x64/0x308 kernel/locking/rwsem.c:1520 __gfs2_iomap_get+0x138/0x1058 fs/gfs2/bmap.c:856 gfs2_iomap_get+0xd8/0x154 fs/gfs2/bmap.c:1396 bh_get+0x208/0x6ac fs/gfs2/quota.c:385 qdsb_get+0x1e0/0x398 fs/gfs2/quota.c:522 gfs2_quota_hold+0x16c/0x558 fs/gfs2/quota.c:608 punch_hole+0xc14/0x2fe8 fs/gfs2/bmap.c:1798 gfs2_iomap_end+0x448/0x618 fs/gfs2/bmap.c:1157 iomap_iter+0x1fc/0x120c fs/iomap/iter.c:79 iomap_file_buffered_write+0x7a8/0x940 fs/iomap/buffered-io.c:846 gfs2_file_buffered_write+0x49c/0x800 fs/gfs2/file.c:1056 gfs2_file_write_iter+0x3d4/0xc3c fs/gfs2/file.c:1157 do_iter_write+0x534/0x964 fs/read_write.c:861 vfs_iter_write+0x88/0xac fs/read_write.c:902 iter_file_splice_write+0x62c/0xc5c fs/splice.c:685 gfs2_file_splice_write+0x17c/0x204 fs/gfs2/file.c:1416 do_splice_from fs/splice.c:763 [inline] direct_splice_actor+0xe4/0x1c0 fs/splice.c:950 splice_direct_to_actor+0x3c4/0x9b4 fs/splice.c:896 do_splice_direct+0x20c/0x348 fs/splice.c:1002 generic_copy_file_range fs/read_write.c:1393 [inline] vfs_copy_file_range+0x9fc/0x122c fs/read_write.c:1539 __do_sys_copy_file_range fs/read_write.c:1596 [inline] __se_sys_copy_file_range fs/read_write.c:1559 [inline] __arm64_sys_copy_file_range+0x578/0x914 fs/read_write.c:1559 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:204 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585 -> #0 (&sdp->sd_quota_mutex){+.+.}-{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+0x3338/0x7680 kernel/locking/lockdep.c:5049 lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5662 __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799 do_qc+0xbc/0x664 fs/gfs2/quota.c:682 gfs2_quota_change+0x238/0x718 fs/gfs2/quota.c:1295 punch_hole+0x2aa8/0x2fe8 fs/gfs2/bmap.c:1938 gfs2_iomap_end+0x448/0x618 fs/gfs2/bmap.c:1157 iomap_iter+0x1fc/0x120c fs/iomap/iter.c:79 iomap_file_buffered_write+0x7a8/0x940 fs/iomap/buffered-io.c:846 gfs2_file_buffered_write+0x49c/0x800 fs/gfs2/file.c:1056 gfs2_file_write_iter+0x3d4/0xc3c fs/gfs2/file.c:1157 do_iter_write+0x534/0x964 fs/read_write.c:861 vfs_iter_write+0x88/0xac fs/read_write.c:902 iter_file_splice_write+0x62c/0xc5c fs/splice.c:685 gfs2_file_splice_write+0x17c/0x204 fs/gfs2/file.c:1416 do_splice_from fs/splice.c:763 [inline] direct_splice_actor+0xe4/0x1c0 fs/splice.c:950 splice_direct_to_actor+0x3c4/0x9b4 fs/splice.c:896 do_splice_direct+0x20c/0x348 fs/splice.c:1002 generic_copy_file_range fs/read_write.c:1393 [inline] vfs_copy_file_range+0x9fc/0x122c fs/read_write.c:1539 __do_sys_copy_file_range fs/read_write.c:1596 [inline] __se_sys_copy_file_range fs/read_write.c:1559 [inline] __arm64_sys_copy_file_range+0x578/0x914 fs/read_write.c:1559 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:204 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585 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.1.321/5633: #0: ffff0000f3de8460 (sb_writers#33){.+.+}-{0:0}, at: vfs_copy_file_range+0x79c/0x122c fs/read_write.c:1502 #1: ffff0000f22c1c30 (&sb->s_type->i_mutex_key#42){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline] #1: ffff0000f22c1c30 (&sb->s_type->i_mutex_key#42){+.+.}-{3:3}, at: gfs2_file_write_iter+0x2cc/0xc3c fs/gfs2/file.c:1114 #2: ffff0000f3de8650 (sb_internal#7){.+.+}-{0:0}, at: gfs2_trans_begin+0xa8/0x11c fs/gfs2/trans.c:118 #3: ffff0000cf63d058 (&sdp->sd_log_flush_lock){.+.+}-{3:3}, at: __gfs2_trans_begin+0x524/0x91c fs/gfs2/trans.c:87 #4: ffff0000f22c20c8 (&ip->i_rw_mutex){++++}-{3:3}, at: sweep_bh_for_rgrps fs/gfs2/bmap.c:1512 [inline] #4: ffff0000f22c20c8 (&ip->i_rw_mutex){++++}-{3:3}, at: punch_hole+0x1fb0/0x2fe8 fs/gfs2/bmap.c:1837 stack backtrace: CPU: 1 PID: 5633 Comm: syz.1.321 Not tainted 6.1.115-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call trace: dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106 dump_stack+0x1c/0x58 lib/dump_stack.c:113 print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2048 check_noncircular+0x2cc/0x378 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+0x3338/0x7680 kernel/locking/lockdep.c:5049 lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5662 __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799 do_qc+0xbc/0x664 fs/gfs2/quota.c:682 gfs2_quota_change+0x238/0x718 fs/gfs2/quota.c:1295 punch_hole+0x2aa8/0x2fe8 fs/gfs2/bmap.c:1938 gfs2_iomap_end+0x448/0x618 fs/gfs2/bmap.c:1157 iomap_iter+0x1fc/0x120c fs/iomap/iter.c:79 iomap_file_buffered_write+0x7a8/0x940 fs/iomap/buffered-io.c:846 gfs2_file_buffered_write+0x49c/0x800 fs/gfs2/file.c:1056 gfs2_file_write_iter+0x3d4/0xc3c fs/gfs2/file.c:1157 do_iter_write+0x534/0x964 fs/read_write.c:861 vfs_iter_write+0x88/0xac fs/read_write.c:902 iter_file_splice_write+0x62c/0xc5c fs/splice.c:685 gfs2_file_splice_write+0x17c/0x204 fs/gfs2/file.c:1416 do_splice_from fs/splice.c:763 [inline] direct_splice_actor+0xe4/0x1c0 fs/splice.c:950 splice_direct_to_actor+0x3c4/0x9b4 fs/splice.c:896 do_splice_direct+0x20c/0x348 fs/splice.c:1002 generic_copy_file_range fs/read_write.c:1393 [inline] vfs_copy_file_range+0x9fc/0x122c fs/read_write.c:1539 __do_sys_copy_file_range fs/read_write.c:1596 [inline] __se_sys_copy_file_range fs/read_write.c:1559 [inline] __arm64_sys_copy_file_range+0x578/0x914 fs/read_write.c:1559 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:204 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585