====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Tainted: G L ------------------------------------------------------ syz.1.5940/31808 is trying to acquire lock: ffff888075bf8610 (sb_internal#3){.+.+}-{0:0}, at: btrfs_dirty_inode+0x9f/0x190 fs/btrfs/inode.c:6324 but task is already holding lock: ffff888030d47180 (&mm->mmap_lock){++++}-{4:4}, at: mmap_write_lock_killable include/linux/mmap_lock.h:353 [inline] ffff888030d47180 (&mm->mmap_lock){++++}-{4:4}, at: vm_mmap_pgoff+0x211/0x4d0 mm/util.c:579 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #5 (&mm->mmap_lock){++++}-{4:4}: down_read_killable+0x50/0x350 kernel/locking/rwsem.c:1560 mmap_read_lock_killable+0x1d/0x70 include/linux/mmap_lock.h:400 get_mmap_lock_carefully mm/mmap_lock.c:399 [inline] lock_mm_and_find_vma+0x2a8/0x300 mm/mmap_lock.c:450 do_user_addr_fault+0x331/0x1380 arch/x86/mm/fault.c:1359 handle_page_fault arch/x86/mm/fault.c:1476 [inline] exc_page_fault+0x82/0x100 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:618 filldir64+0x2ac/0x690 fs/readdir.c:-1 dir_emit include/linux/fs.h:3527 [inline] offset_dir_emit fs/libfs.c:499 [inline] offset_iterate_dir fs/libfs.c:515 [inline] offset_readdir+0x44c/0x560 fs/libfs.c:564 iterate_dir+0x399/0x570 fs/readdir.c:108 __do_sys_getdents64 fs/readdir.c:410 [inline] __se_sys_getdents64+0xe4/0x260 fs/readdir.c:396 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #4 (&type->i_mutex_dir_key#5){++++}-{4:4}: down_read+0x47/0x2e0 kernel/locking/rwsem.c:1537 inode_lock_shared include/linux/fs.h:1042 [inline] lookup_slow+0x46/0x70 fs/namei.c:1874 walk_component fs/namei.c:2221 [inline] lookup_last fs/namei.c:2722 [inline] path_lookupat+0x3f5/0x8c0 fs/namei.c:2746 filename_lookup+0x212/0x570 fs/namei.c:2775 kern_path+0x35/0x50 fs/namei.c:2987 is_same_device fs/btrfs/volumes.c:759 [inline] device_list_add+0xe21/0x22b0 fs/btrfs/volumes.c:893 btrfs_scan_one_device+0x3ef/0x680 fs/btrfs/volumes.c:1492 btrfs_get_tree_super fs/btrfs/super.c:1860 [inline] btrfs_get_tree_subvol fs/btrfs/super.c:2089 [inline] btrfs_get_tree+0x4ab/0x1920 fs/btrfs/super.c:2123 vfs_get_tree+0x92/0x2a0 fs/super.c:1751 fc_mount fs/namespace.c:1199 [inline] do_new_mount_fc fs/namespace.c:3636 [inline] do_new_mount+0x302/0xa10 fs/namespace.c:3712 do_mount fs/namespace.c:4035 [inline] __do_sys_mount fs/namespace.c:4224 [inline] __se_sys_mount+0x313/0x410 fs/namespace.c:4201 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #3 (&fs_devs->device_list_mutex){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:614 [inline] __mutex_lock+0x187/0x1350 kernel/locking/mutex.c:776 btrfs_run_dev_stats+0xf6/0x1030 fs/btrfs/volumes.c:7722 commit_cowonly_roots+0x1b2/0x860 fs/btrfs/transaction.c:1357 btrfs_commit_transaction+0x105b/0x3b10 fs/btrfs/transaction.c:2477 sync_filesystem+0x1cf/0x230 fs/sync.c:66 generic_shutdown_super+0x6f/0x2c0 fs/super.c:622 kill_anon_super+0x3b/0x70 fs/super.c:1289 btrfs_kill_super+0x41/0x50 fs/btrfs/super.c:2129 deactivate_locked_super+0xbc/0x130 fs/super.c:474 cleanup_mnt+0x425/0x4c0 fs/namespace.c:1318 task_work_run+0x1d4/0x260 kernel/task_work.c:233 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] __exit_to_user_mode_loop kernel/entry/common.c:44 [inline] exit_to_user_mode_loop+0xff/0x4f0 kernel/entry/common.c:75 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:226 [inline] syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:256 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:159 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:194 [inline] do_syscall_64+0x2d0/0xf80 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #2 (&fs_info->reloc_mutex){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:614 [inline] __mutex_lock+0x187/0x1350 kernel/locking/mutex.c:776 btrfs_commit_transaction+0xf6b/0x3b10 fs/btrfs/transaction.c:2423 sync_filesystem+0x1cf/0x230 fs/sync.c:66 generic_shutdown_super+0x6f/0x2c0 fs/super.c:622 kill_anon_super+0x3b/0x70 fs/super.c:1289 btrfs_kill_super+0x41/0x50 fs/btrfs/super.c:2129 deactivate_locked_super+0xbc/0x130 fs/super.c:474 cleanup_mnt+0x425/0x4c0 fs/namespace.c:1318 task_work_run+0x1d4/0x260 kernel/task_work.c:233 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] __exit_to_user_mode_loop kernel/entry/common.c:44 [inline] exit_to_user_mode_loop+0xff/0x4f0 kernel/entry/common.c:75 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:226 [inline] syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:256 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:159 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:194 [inline] do_syscall_64+0x2d0/0xf80 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (btrfs_trans_unblocked){++++}-{0:0}: wait_current_trans+0x22b/0x520 fs/btrfs/transaction.c:533 start_transaction+0x6a5/0x15f0 fs/btrfs/transaction.c:704 btrfs_create_common+0x146/0x2f0 fs/btrfs/inode.c:6838 lookup_open fs/namei.c:4440 [inline] open_last_lookups fs/namei.c:4540 [inline] path_openat+0x18bb/0x3dd0 fs/namei.c:4784 do_filp_open+0x1fa/0x410 fs/namei.c:4814 do_sys_openat2+0x121/0x200 fs/open.c:1430 do_sys_open fs/open.c:1436 [inline] __do_sys_openat fs/open.c:1452 [inline] __se_sys_openat fs/open.c:1447 [inline] __x64_sys_openat+0x138/0x170 fs/open.c:1447 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (sb_internal#3){.+.+}-{0:0}: check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x15a6/0x2cf0 kernel/locking/lockdep.c:5237 lock_acquire+0x117/0x340 kernel/locking/lockdep.c:5868 percpu_down_read_internal include/linux/percpu-rwsem.h:53 [inline] percpu_down_read_freezable include/linux/percpu-rwsem.h:83 [inline] __sb_start_write include/linux/fs/super.h:19 [inline] sb_start_intwrite include/linux/fs/super.h:177 [inline] start_transaction+0x56f/0x15f0 fs/btrfs/transaction.c:701 btrfs_dirty_inode+0x9f/0x190 fs/btrfs/inode.c:6324 inode_update_time fs/inode.c:2167 [inline] touch_atime+0x2f9/0x6d0 fs/inode.c:2240 file_accessed include/linux/fs.h:2254 [inline] btrfs_file_mmap_prepare+0x176/0x1f0 fs/btrfs/file.c:2053 vfs_mmap_prepare include/linux/fs.h:2058 [inline] call_mmap_prepare mm/vma.c:2596 [inline] __mmap_region mm/vma.c:2692 [inline] mmap_region+0xb2b/0x1d10 mm/vma.c:2786 do_mmap+0xc45/0x10d0 mm/mmap.c:558 vm_mmap_pgoff+0x2a6/0x4d0 mm/util.c:581 ksys_mmap_pgoff+0x51f/0x760 mm/mmap.c:604 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Chain exists of: sb_internal#3 --> &type->i_mutex_dir_key#5 --> &mm->mmap_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&mm->mmap_lock); lock(&type->i_mutex_dir_key#5); lock(&mm->mmap_lock); rlock(sb_internal#3); *** DEADLOCK *** 2 locks held by syz.1.5940/31808: #0: ffff888030d47180 (&mm->mmap_lock){++++}-{4:4}, at: mmap_write_lock_killable include/linux/mmap_lock.h:353 [inline] #0: ffff888030d47180 (&mm->mmap_lock){++++}-{4:4}, at: vm_mmap_pgoff+0x211/0x4d0 mm/util.c:579 #1: ffff888075bf8420 (sb_writers#15){.+.+}-{0:0}, at: file_accessed include/linux/fs.h:2254 [inline] #1: ffff888075bf8420 (sb_writers#15){.+.+}-{0:0}, at: btrfs_file_mmap_prepare+0x176/0x1f0 fs/btrfs/file.c:2053 stack backtrace: CPU: 0 UID: 0 PID: 31808 Comm: syz.1.5940 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025 Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_circular_bug+0x2e2/0x300 kernel/locking/lockdep.c:2043 check_noncircular+0x12e/0x150 kernel/locking/lockdep.c:2175 check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x15a6/0x2cf0 kernel/locking/lockdep.c:5237 lock_acquire+0x117/0x340 kernel/locking/lockdep.c:5868 percpu_down_read_internal include/linux/percpu-rwsem.h:53 [inline] percpu_down_read_freezable include/linux/percpu-rwsem.h:83 [inline] __sb_start_write include/linux/fs/super.h:19 [inline] sb_start_intwrite include/linux/fs/super.h:177 [inline] start_transaction+0x56f/0x15f0 fs/btrfs/transaction.c:701 btrfs_dirty_inode+0x9f/0x190 fs/btrfs/inode.c:6324 inode_update_time fs/inode.c:2167 [inline] touch_atime+0x2f9/0x6d0 fs/inode.c:2240 file_accessed include/linux/fs.h:2254 [inline] btrfs_file_mmap_prepare+0x176/0x1f0 fs/btrfs/file.c:2053 vfs_mmap_prepare include/linux/fs.h:2058 [inline] call_mmap_prepare mm/vma.c:2596 [inline] __mmap_region mm/vma.c:2692 [inline] mmap_region+0xb2b/0x1d10 mm/vma.c:2786 do_mmap+0xc45/0x10d0 mm/mmap.c:558 vm_mmap_pgoff+0x2a6/0x4d0 mm/util.c:581 ksys_mmap_pgoff+0x51f/0x760 mm/mmap.c:604 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f38c678f749 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:00007f38c760c038 EFLAGS: 00000246 ORIG_RAX: 0000000000000009 RAX: ffffffffffffffda RBX: 00007f38c69e6090 RCX: 00007f38c678f749 RDX: 00000000027ffff7 RSI: 0000000000600000 RDI: 0000200000000000 RBP: 00007f38c6813f91 R08: 000000000000000a R09: 0000000000004000 R10: 0000000004012011 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f38c69e6128 R14: 00007f38c69e6090 R15: 00007ffc9bdc1408