====================================================== WARNING: possible circular locking dependency detected 6.1.0-rc5-syzkaller-00015-g81e7cfa3a9eb #0 Not tainted ------------------------------------------------------ syz-executor.5/11411 is trying to acquire lock: ffff888075960650 (sb_internal#2){.+.+}-{0:0}, at: btrfs_dirty_inode+0xcc/0x1c0 fs/btrfs/inode.c:6085 but task is already holding lock: ffff88807e130158 (&mm->mmap_lock#2){++++}-{3:3}, at: mmap_write_lock_killable include/linux/mmap_lock.h:87 [inline] ffff88807e130158 (&mm->mmap_lock#2){++++}-{3:3}, at: vm_mmap_pgoff+0x14d/0x2b0 mm/util.c:518 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #4 (&mm->mmap_lock#2){++++}-{3:3}: lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5668 __might_fault+0xb2/0x110 mm/memory.c:5646 _copy_to_user+0x26/0x130 lib/usercopy.c:29 copy_to_user include/linux/uaccess.h:169 [inline] btrfs_ioctl_get_subvol_rootref+0x8cf/0xa90 fs/btrfs/ioctl.c:3203 btrfs_ioctl+0xb7c/0xc10 fs/btrfs/ioctl.c:5556 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #3 (btrfs-root-00){++++}-{3:3}: lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5668 down_write_nested+0xa2/0x280 kernel/locking/rwsem.c:1672 __btrfs_tree_lock fs/btrfs/locking.c:196 [inline] btrfs_tree_lock fs/btrfs/locking.c:203 [inline] btrfs_lock_root_node+0x298/0x4b0 fs/btrfs/locking.c:256 commit_cowonly_roots+0x128/0x840 fs/btrfs/transaction.c:1266 btrfs_commit_transaction+0x154b/0x3760 fs/btrfs/transaction.c:2376 close_ctree+0x3a7/0xbde fs/btrfs/disk-io.c:4653 generic_shutdown_super+0x130/0x310 fs/super.c:492 kill_anon_super+0x36/0x60 fs/super.c:1086 btrfs_kill_super+0x3d/0x50 fs/btrfs/super.c:2441 deactivate_locked_super+0xa7/0xf0 fs/super.c:332 cleanup_mnt+0x494/0x520 fs/namespace.c:1186 task_work_run+0x243/0x300 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0x124/0x150 kernel/entry/common.c:171 exit_to_user_mode_prepare+0xb2/0x140 kernel/entry/common.c:203 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x26/0x60 kernel/entry/common.c:296 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #2 (&fs_info->reloc_mutex){+.+.}-{3:3}: lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5668 __mutex_lock_common+0x1bd/0x26e0 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:799 btrfs_commit_transaction+0x13e8/0x3760 fs/btrfs/transaction.c:2316 close_ctree+0x3a7/0xbde fs/btrfs/disk-io.c:4653 generic_shutdown_super+0x130/0x310 fs/super.c:492 kill_anon_super+0x36/0x60 fs/super.c:1086 btrfs_kill_super+0x3d/0x50 fs/btrfs/super.c:2441 deactivate_locked_super+0xa7/0xf0 fs/super.c:332 cleanup_mnt+0x494/0x520 fs/namespace.c:1186 task_work_run+0x243/0x300 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0x124/0x150 kernel/entry/common.c:171 exit_to_user_mode_prepare+0xb2/0x140 kernel/entry/common.c:203 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x26/0x60 kernel/entry/common.c:296 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #1 (btrfs_trans_unblocked){++++}-{0:0}: lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5668 wait_current_trans+0x21b/0x490 fs/btrfs/transaction.c:512 start_transaction+0x6d8/0x1180 fs/btrfs/transaction.c:655 btrfs_sync_file+0xc95/0x1140 fs/btrfs/file.c:2224 generic_write_sync include/linux/fs.h:2883 [inline] iomap_dio_complete+0x5d7/0x740 fs/iomap/direct-io.c:128 btrfs_direct_write fs/btrfs/file.c:1848 [inline] btrfs_do_write_iter+0x8b6/0x1260 fs/btrfs/file.c:1980 do_iter_write+0x6c2/0xc20 fs/read_write.c:861 iter_file_splice_write+0x7fc/0xfc0 fs/splice.c:686 do_splice_from fs/splice.c:764 [inline] direct_splice_actor+0xe6/0x1c0 fs/splice.c:931 splice_direct_to_actor+0x4e4/0xc00 fs/splice.c:886 do_splice_direct+0x279/0x3d0 fs/splice.c:974 do_sendfile+0x5fb/0xf80 fs/read_write.c:1255 __do_sys_sendfile64 fs/read_write.c:1323 [inline] __se_sys_sendfile64+0x14f/0x1b0 fs/read_write.c:1309 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #0 (sb_internal#2){.+.+}-{0:0}: check_prev_add kernel/locking/lockdep.c:3097 [inline] check_prevs_add kernel/locking/lockdep.c:3216 [inline] validate_chain+0x1898/0x6ae0 kernel/locking/lockdep.c:3831 __lock_acquire+0x1292/0x1f60 kernel/locking/lockdep.c:5055 lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5668 percpu_down_read include/linux/percpu-rwsem.h:51 [inline] __sb_start_write include/linux/fs.h:1826 [inline] sb_start_intwrite include/linux/fs.h:1948 [inline] start_transaction+0x5cb/0x1180 fs/btrfs/transaction.c:652 btrfs_dirty_inode+0xcc/0x1c0 fs/btrfs/inode.c:6085 inode_update_time fs/inode.c:1871 [inline] touch_atime+0x315/0x630 fs/inode.c:1944 file_accessed include/linux/fs.h:2521 [inline] btrfs_file_mmap+0xbb/0x120 fs/btrfs/file.c:2333 call_mmap include/linux/fs.h:2196 [inline] mmap_region+0xfe6/0x1e20 mm/mmap.c:2625 do_mmap+0x8d9/0xf30 mm/mmap.c:1412 vm_mmap_pgoff+0x19e/0x2b0 mm/util.c:520 ksys_mmap_pgoff+0x48c/0x6d0 mm/mmap.c:1458 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd other info that might help us debug this: Chain exists of: sb_internal#2 --> btrfs-root-00 --> &mm->mmap_lock#2 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&mm->mmap_lock#2); lock(btrfs-root-00); lock(&mm->mmap_lock#2); lock(sb_internal#2); *** DEADLOCK *** 2 locks held by syz-executor.5/11411: #0: ffff88807e130158 (&mm->mmap_lock#2){++++}-{3:3}, at: mmap_write_lock_killable include/linux/mmap_lock.h:87 [inline] #0: ffff88807e130158 (&mm->mmap_lock#2){++++}-{3:3}, at: vm_mmap_pgoff+0x14d/0x2b0 mm/util.c:518 #1: ffff888075960460 (sb_writers#16){.+.+}-{0:0}, at: file_accessed include/linux/fs.h:2521 [inline] #1: ffff888075960460 (sb_writers#16){.+.+}-{0:0}, at: btrfs_file_mmap+0xbb/0x120 fs/btrfs/file.c:2333 stack backtrace: CPU: 1 PID: 11411 Comm: syz-executor.5 Not tainted 6.1.0-rc5-syzkaller-00015-g81e7cfa3a9eb #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1b1/0x28e lib/dump_stack.c:106 check_noncircular+0x2cc/0x390 kernel/locking/lockdep.c:2177 check_prev_add kernel/locking/lockdep.c:3097 [inline] check_prevs_add kernel/locking/lockdep.c:3216 [inline] validate_chain+0x1898/0x6ae0 kernel/locking/lockdep.c:3831 __lock_acquire+0x1292/0x1f60 kernel/locking/lockdep.c:5055 lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5668 percpu_down_read include/linux/percpu-rwsem.h:51 [inline] __sb_start_write include/linux/fs.h:1826 [inline] sb_start_intwrite include/linux/fs.h:1948 [inline] start_transaction+0x5cb/0x1180 fs/btrfs/transaction.c:652 btrfs_dirty_inode+0xcc/0x1c0 fs/btrfs/inode.c:6085 inode_update_time fs/inode.c:1871 [inline] touch_atime+0x315/0x630 fs/inode.c:1944 file_accessed include/linux/fs.h:2521 [inline] btrfs_file_mmap+0xbb/0x120 fs/btrfs/file.c:2333 call_mmap include/linux/fs.h:2196 [inline] mmap_region+0xfe6/0x1e20 mm/mmap.c:2625 do_mmap+0x8d9/0xf30 mm/mmap.c:1412 vm_mmap_pgoff+0x19e/0x2b0 mm/util.c:520 ksys_mmap_pgoff+0x48c/0x6d0 mm/mmap.c:1458 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fd17448b639 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fd175112168 EFLAGS: 00000246 ORIG_RAX: 0000000000000009 RAX: ffffffffffffffda RBX: 00007fd1745abf80 RCX: 00007fd17448b639 RDX: 0000000000000001 RSI: 0000000000400000 RDI: 0000000020000000 RBP: 00007fd1744e6ae9 R08: 0000000000000003 R09: 0000000000000000 R10: 0000000000010012 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffef691284f R14: 00007fd175112300 R15: 0000000000022000