====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz-executor/4309 is trying to acquire lock: ffff888147859ce0 (&fs_devs->device_list_mutex){+.+.}-{3:3}, at: btrfs_run_dev_stats+0xe2/0xe70 fs/btrfs/volumes.c:7992 but task is already holding lock: ffff8880760b8720 (&fs_info->tree_log_mutex){+.+.}-{3:3}, at: btrfs_commit_transaction+0x1242/0x3570 fs/btrfs/transaction.c:2369 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #6 (&fs_info->tree_log_mutex){+.+.}-{3:3}: __mutex_lock_common+0x1e3/0x2400 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 btrfs_commit_transaction+0x1242/0x3570 fs/btrfs/transaction.c:2369 sync_filesystem+0x1be/0x220 fs/sync.c:66 generic_shutdown_super+0x6b/0x300 fs/super.c:448 kill_anon_super+0x36/0x70 fs/super.c:1089 btrfs_kill_super+0x3d/0x50 fs/btrfs/super.c:2390 deactivate_locked_super+0x93/0xf0 fs/super.c:335 cleanup_mnt+0x42d/0x4e0 fs/namespace.c:1148 task_work_run+0x125/0x1a0 kernel/task_work.c:188 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop+0x10f/0x130 kernel/entry/common.c:181 exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:214 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline] syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #5 (&fs_info->reloc_mutex){+.+.}-{3:3}: __mutex_lock_common+0x1e3/0x2400 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 btrfs_record_root_in_trans+0x14b/0x180 fs/btrfs/transaction.c:513 start_transaction+0x3b0/0x1130 fs/btrfs/transaction.c:750 btrfs_create+0x111/0x5d0 fs/btrfs/inode.c:6915 lookup_open fs/namei.c:3470 [inline] open_last_lookups fs/namei.c:3540 [inline] path_openat+0x11db/0x2fa0 fs/namei.c:3747 do_filp_open+0x1e2/0x410 fs/namei.c:3777 do_sys_openat2+0x150/0x4b0 fs/open.c:1255 do_sys_open fs/open.c:1271 [inline] __do_sys_creat fs/open.c:1347 [inline] __se_sys_creat fs/open.c:1341 [inline] __x64_sys_creat+0x8c/0xb0 fs/open.c:1341 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #4 (sb_internal#2){.+.+}-{0:0}: percpu_down_read include/linux/percpu-rwsem.h:51 [inline] __sb_start_write include/linux/fs.h:1811 [inline] sb_start_intwrite include/linux/fs.h:1928 [inline] start_transaction+0x5bc/0x1130 fs/btrfs/transaction.c:680 btrfs_dirty_inode+0xc5/0x1c0 fs/btrfs/inode.c:6451 inode_update_time fs/inode.c:1893 [inline] file_update_time+0x3a6/0x440 fs/inode.c:2083 btrfs_page_mkwrite+0x37d/0xc80 fs/btrfs/inode.c:8953 do_page_mkwrite+0x168/0x3c0 mm/memory.c:2922 wp_page_shared+0x16b/0x6d0 mm/memory.c:3259 handle_pte_fault mm/memory.c:4668 [inline] __handle_mm_fault mm/memory.c:4785 [inline] handle_mm_fault+0x1f06/0x4410 mm/memory.c:4883 do_user_addr_fault+0x489/0xc80 arch/x86/mm/fault.c:1357 handle_page_fault arch/x86/mm/fault.c:1445 [inline] exc_page_fault+0x60/0x100 arch/x86/mm/fault.c:1501 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:606 __put_user_nocheck_8+0x3/0x21 __do_sys_io_setup fs/aio.c:1347 [inline] __se_sys_io_setup+0xd6/0x190 fs/aio.c:1327 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #3 (sb_pagefaults#2){.+.+}-{0:0}: percpu_down_read include/linux/percpu-rwsem.h:51 [inline] __sb_start_write include/linux/fs.h:1811 [inline] sb_start_pagefault include/linux/fs.h:1910 [inline] btrfs_page_mkwrite+0x1b7/0xc80 fs/btrfs/inode.c:8937 do_page_mkwrite+0x168/0x3c0 mm/memory.c:2922 wp_page_shared+0x16b/0x6d0 mm/memory.c:3259 handle_pte_fault mm/memory.c:4668 [inline] __handle_mm_fault mm/memory.c:4785 [inline] handle_mm_fault+0x1f06/0x4410 mm/memory.c:4883 do_user_addr_fault+0x489/0xc80 arch/x86/mm/fault.c:1357 handle_page_fault arch/x86/mm/fault.c:1445 [inline] exc_page_fault+0x60/0x100 arch/x86/mm/fault.c:1501 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:606 __put_user_nocheck_8+0x3/0x21 __do_sys_io_setup fs/aio.c:1347 [inline] __se_sys_io_setup+0xd6/0x190 fs/aio.c:1327 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #2 (&mm->mmap_lock){++++}-{3:3}: down_read+0x44/0x2e0 kernel/locking/rwsem.c:1498 mmap_read_lock+0x1c/0x50 include/linux/mmap_lock.h:117 do_user_addr_fault+0xc35/0xc80 arch/x86/mm/fault.c:1308 handle_page_fault arch/x86/mm/fault.c:1445 [inline] exc_page_fault+0x60/0x100 arch/x86/mm/fault.c:1501 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:606 user_access_begin arch/x86/include/asm/uaccess.h:576 [inline] filldir64+0x30a/0x6f0 fs/readdir.c:331 dir_emit_dot include/linux/fs.h:3718 [inline] dir_emit_dots include/linux/fs.h:3729 [inline] dcache_readdir+0x173/0x7c0 fs/libfs.c:196 iterate_dir+0x218/0x560 fs/readdir.c:-1 __do_sys_getdents64 fs/readdir.c:369 [inline] __se_sys_getdents64+0xf2/0x270 fs/readdir.c:354 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #1 (&type->i_mutex_dir_key#3){++++}-{3:3}: down_read+0x44/0x2e0 kernel/locking/rwsem.c:1498 inode_lock_shared include/linux/fs.h:797 [inline] lookup_slow+0x46/0x70 fs/namei.c:1687 walk_component+0x319/0x460 fs/namei.c:1984 lookup_last fs/namei.c:2439 [inline] path_lookupat+0x169/0x440 fs/namei.c:2463 filename_lookup+0x214/0x540 fs/namei.c:2492 kern_path+0x37/0x190 fs/namei.c:2590 lookup_bdev+0xc5/0x280 block/bdev.c:982 device_matched fs/btrfs/volumes.c:568 [inline] btrfs_free_stale_devices+0x6ec/0xa90 fs/btrfs/volumes.c:608 btrfs_forget_devices+0x52/0x80 fs/btrfs/volumes.c:1431 btrfs_control_ioctl+0x10a/0x220 fs/btrfs/super.c:2450 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:860 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #0 (&fs_devs->device_list_mutex){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain kernel/locking/lockdep.c:3788 [inline] __lock_acquire+0x2c42/0x7d10 kernel/locking/lockdep.c:5012 lock_acquire+0x19e/0x400 kernel/locking/lockdep.c:5623 __mutex_lock_common+0x1e3/0x2400 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 btrfs_run_dev_stats+0xe2/0xe70 fs/btrfs/volumes.c:7992 commit_cowonly_roots+0x185/0x9c0 fs/btrfs/transaction.c:1292 btrfs_commit_transaction+0x130d/0x3570 fs/btrfs/transaction.c:2394 sync_filesystem+0x1be/0x220 fs/sync.c:66 generic_shutdown_super+0x6b/0x300 fs/super.c:448 kill_anon_super+0x36/0x70 fs/super.c:1089 btrfs_kill_super+0x3d/0x50 fs/btrfs/super.c:2390 deactivate_locked_super+0x93/0xf0 fs/super.c:335 cleanup_mnt+0x42d/0x4e0 fs/namespace.c:1148 task_work_run+0x125/0x1a0 kernel/task_work.c:188 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop+0x10f/0x130 kernel/entry/common.c:181 exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:214 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline] syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x66/0xd0 other info that might help us debug this: Chain exists of: &fs_devs->device_list_mutex --> &fs_info->reloc_mutex --> &fs_info->tree_log_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&fs_info->tree_log_mutex); lock(&fs_info->reloc_mutex); lock(&fs_info->tree_log_mutex); lock(&fs_devs->device_list_mutex); *** DEADLOCK *** 3 locks held by syz-executor/4309: #0: ffff88807e4100e0 (&type->s_umount_key#54){+.+.}-{3:3}, at: deactivate_super+0xa0/0xd0 fs/super.c:365 #1: ffff8880760b8c90 (&fs_info->reloc_mutex){+.+.}-{3:3}, at: btrfs_commit_transaction+0x1191/0x3570 fs/btrfs/transaction.c:2319 #2: ffff8880760b8720 (&fs_info->tree_log_mutex){+.+.}-{3:3}, at: btrfs_commit_transaction+0x1242/0x3570 fs/btrfs/transaction.c:2369 stack backtrace: CPU: 1 PID: 4309 Comm: syz-executor Not tainted syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025 Call Trace: dump_stack_lvl+0x188/0x250 lib/dump_stack.c:106 check_noncircular+0x296/0x330 kernel/locking/lockdep.c:2133 check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain kernel/locking/lockdep.c:3788 [inline] __lock_acquire+0x2c42/0x7d10 kernel/locking/lockdep.c:5012 lock_acquire+0x19e/0x400 kernel/locking/lockdep.c:5623 __mutex_lock_common+0x1e3/0x2400 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 btrfs_run_dev_stats+0xe2/0xe70 fs/btrfs/volumes.c:7992 commit_cowonly_roots+0x185/0x9c0 fs/btrfs/transaction.c:1292 btrfs_commit_transaction+0x130d/0x3570 fs/btrfs/transaction.c:2394 sync_filesystem+0x1be/0x220 fs/sync.c:66 generic_shutdown_super+0x6b/0x300 fs/super.c:448 kill_anon_super+0x36/0x70 fs/super.c:1089 btrfs_kill_super+0x3d/0x50 fs/btrfs/super.c:2390 deactivate_locked_super+0x93/0xf0 fs/super.c:335 cleanup_mnt+0x42d/0x4e0 fs/namespace.c:1148 task_work_run+0x125/0x1a0 kernel/task_work.c:188 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop+0x10f/0x130 kernel/entry/common.c:181 exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:214 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline] syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7fb7ce664117 Code: a2 c7 05 7c 94 24 00 00 00 00 00 eb 96 e8 e1 12 00 00 90 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 e8 ff ff ff f7 d8 64 89 02 b8 RSP: 002b:00007ffc1f0234d8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6 RAX: 0000000000000000 RBX: 00007fb7ce6cc71f RCX: 00007fb7ce664117 RDX: 0000000000000000 RSI: 0000000000000009 RDI: 00007ffc1f023590 RBP: 00007ffc1f023590 R08: 00007ffc1f024590 R09: 00000000ffffffff R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffc1f024620 R13: 00007fb7ce6cc71f R14: 0000000000012d4a R15: 00007ffc1f024660