====================================================== WARNING: possible circular locking dependency detected 5.15.184-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor/4661 is trying to acquire lock: ffff0000ea2344e0 (&fs_devs->device_list_mutex){+.+.}-{3:3}, at: btrfs_run_dev_stats+0xe0/0xcac fs/btrfs/volumes.c:7985 but task is already holding lock: ffff0000e7670720 (&fs_info->tree_log_mutex){+.+.}-{3:3}, at: btrfs_commit_transaction+0xe44/0x3044 fs/btrfs/transaction.c:2369 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #4 (&fs_info->tree_log_mutex){+.+.}-{3:3}: __mutex_lock_common+0x194/0x1edc kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0xac/0x11c kernel/locking/mutex.c:743 btrfs_commit_transaction+0xe44/0x3044 fs/btrfs/transaction.c:2369 btrfs_sync_fs+0x628/0xb2c fs/btrfs/super.c:1454 sync_filesystem+0x1a0/0x218 fs/sync.c:66 generic_shutdown_super+0x70/0x2f0 fs/super.c:448 kill_anon_super+0x4c/0x80 fs/super.c:1089 btrfs_kill_super+0x40/0x58 fs/btrfs/super.c:2390 deactivate_locked_super+0xb8/0x13c fs/super.c:335 deactivate_super+0xf8/0x118 fs/super.c:366 cleanup_mnt+0x3a4/0x458 fs/namespace.c:1143 __cleanup_mnt+0x20/0x30 fs/namespace.c:1150 task_work_run+0x12c/0x1e0 kernel/task_work.c:188 tracehook_notify_resume include/linux/tracehook.h:189 [inline] do_notify_resume+0x24b4/0x3128 arch/arm64/kernel/signal.c:949 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:133 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:138 [inline] el0_svc+0xf0/0x1e0 arch/arm64/kernel/entry-common.c:609 el0t_64_sync_handler+0xcc/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 -> #3 (&fs_info->reloc_mutex){+.+.}-{3:3}: __mutex_lock_common+0x194/0x1edc kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0xac/0x11c kernel/locking/mutex.c:743 btrfs_record_root_in_trans fs/btrfs/transaction.c:513 [inline] start_transaction+0x440/0x13f0 fs/btrfs/transaction.c:750 btrfs_start_transaction+0x34/0x44 fs/btrfs/transaction.c:779 btrfs_create+0xf0/0x508 fs/btrfs/inode.c:6900 lookup_open fs/namei.c:3462 [inline] open_last_lookups fs/namei.c:3532 [inline] path_openat+0x1144/0x26e4 fs/namei.c:3739 do_filp_open+0x164/0x330 fs/namei.c:3769 do_sys_openat2+0x128/0x3d8 fs/open.c:1253 do_sys_open fs/open.c:1269 [inline] __do_sys_openat fs/open.c:1285 [inline] __se_sys_openat fs/open.c:1280 [inline] __arm64_sys_openat+0x120/0x154 fs/open.c:1280 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x78/0x1e0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0xcc/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 -> #2 (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+0x624/0x13f0 fs/btrfs/transaction.c:680 btrfs_start_transaction+0x34/0x44 fs/btrfs/transaction.c:779 btrfs_create+0xf0/0x508 fs/btrfs/inode.c:6900 lookup_open fs/namei.c:3462 [inline] open_last_lookups fs/namei.c:3532 [inline] path_openat+0x1144/0x26e4 fs/namei.c:3739 do_filp_open+0x164/0x330 fs/namei.c:3769 do_sys_openat2+0x128/0x3d8 fs/open.c:1253 do_sys_open fs/open.c:1269 [inline] __do_sys_openat fs/open.c:1285 [inline] __se_sys_openat fs/open.c:1280 [inline] __arm64_sys_openat+0x120/0x154 fs/open.c:1280 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x78/0x1e0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0xcc/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 -> #1 (&type->i_mutex_dir_key#8){++++}-{3:3}: down_read+0xc0/0x390 kernel/locking/rwsem.c:1498 inode_lock_shared include/linux/fs.h:797 [inline] lookup_slow+0x4c/0x80 fs/namei.c:1679 walk_component+0x2b0/0x3a8 fs/namei.c:1976 lookup_last fs/namei.c:2431 [inline] path_lookupat+0x13c/0x3d0 fs/namei.c:2455 filename_lookup+0x180/0x414 fs/namei.c:2484 kern_path+0x4c/0x190 fs/namei.c:2582 lookup_bdev+0xbc/0x244 block/bdev.c:982 device_matched fs/btrfs/volumes.c:568 [inline] btrfs_free_stale_devices+0x614/0x908 fs/btrfs/volumes.c:608 btrfs_forget_devices+0x5c/0x98 fs/btrfs/volumes.c:1431 btrfs_control_ioctl+0x130/0x248 fs/btrfs/super.c:2450 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl fs/ioctl.c:860 [inline] __arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:860 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x78/0x1e0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0xcc/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 -> #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+0x2928/0x651c kernel/locking/lockdep.c:5012 lock_acquire+0x1f4/0x620 kernel/locking/lockdep.c:5623 __mutex_lock_common+0x194/0x1edc kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0xac/0x11c kernel/locking/mutex.c:743 btrfs_run_dev_stats+0xe0/0xcac fs/btrfs/volumes.c:7985 commit_cowonly_roots+0x144/0x7e8 fs/btrfs/transaction.c:1292 btrfs_commit_transaction+0xf04/0x3044 fs/btrfs/transaction.c:2394 btrfs_sync_fs+0x628/0xb2c fs/btrfs/super.c:1454 sync_filesystem+0x1a0/0x218 fs/sync.c:66 generic_shutdown_super+0x70/0x2f0 fs/super.c:448 kill_anon_super+0x4c/0x80 fs/super.c:1089 btrfs_kill_super+0x40/0x58 fs/btrfs/super.c:2390 deactivate_locked_super+0xb8/0x13c fs/super.c:335 deactivate_super+0xf8/0x118 fs/super.c:366 cleanup_mnt+0x3a4/0x458 fs/namespace.c:1143 __cleanup_mnt+0x20/0x30 fs/namespace.c:1150 task_work_run+0x12c/0x1e0 kernel/task_work.c:188 tracehook_notify_resume include/linux/tracehook.h:189 [inline] do_notify_resume+0x24b4/0x3128 arch/arm64/kernel/signal.c:949 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:133 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:138 [inline] el0_svc+0xf0/0x1e0 arch/arm64/kernel/entry-common.c:609 el0t_64_sync_handler+0xcc/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 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/4661: #0: ffff0000d8f2c0e0 (&type->s_umount_key#50){+.+.}-{3:3}, at: deactivate_super+0xf0/0x118 fs/super.c:365 #1: ffff0000e7670c90 (&fs_info->reloc_mutex){+.+.}-{3:3}, at: btrfs_commit_transaction+0xda8/0x3044 fs/btrfs/transaction.c:2319 #2: ffff0000e7670720 (&fs_info->tree_log_mutex){+.+.}-{3:3}, at: btrfs_commit_transaction+0xe44/0x3044 fs/btrfs/transaction.c:2369 stack backtrace: CPU: 1 PID: 4661 Comm: syz-executor Not tainted 5.15.184-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Call trace: dump_backtrace+0x0/0x43c arch/arm64/kernel/stacktrace.c:152 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216 __dump_stack+0x30/0x40 lib/dump_stack.c:88 dump_stack_lvl+0xf8/0x160 lib/dump_stack.c:106 dump_stack+0x1c/0x5c lib/dump_stack.c:113 print_circular_bug+0x148/0x1b0 kernel/locking/lockdep.c:2011 check_noncircular+0x240/0x2d4 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+0x2928/0x651c kernel/locking/lockdep.c:5012 lock_acquire+0x1f4/0x620 kernel/locking/lockdep.c:5623 __mutex_lock_common+0x194/0x1edc kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0xac/0x11c kernel/locking/mutex.c:743 btrfs_run_dev_stats+0xe0/0xcac fs/btrfs/volumes.c:7985 commit_cowonly_roots+0x144/0x7e8 fs/btrfs/transaction.c:1292 btrfs_commit_transaction+0xf04/0x3044 fs/btrfs/transaction.c:2394 btrfs_sync_fs+0x628/0xb2c fs/btrfs/super.c:1454 sync_filesystem+0x1a0/0x218 fs/sync.c:66 generic_shutdown_super+0x70/0x2f0 fs/super.c:448 kill_anon_super+0x4c/0x80 fs/super.c:1089 btrfs_kill_super+0x40/0x58 fs/btrfs/super.c:2390 deactivate_locked_super+0xb8/0x13c fs/super.c:335 deactivate_super+0xf8/0x118 fs/super.c:366 cleanup_mnt+0x3a4/0x458 fs/namespace.c:1143 __cleanup_mnt+0x20/0x30 fs/namespace.c:1150 task_work_run+0x12c/0x1e0 kernel/task_work.c:188 tracehook_notify_resume include/linux/tracehook.h:189 [inline] do_notify_resume+0x24b4/0x3128 arch/arm64/kernel/signal.c:949 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:133 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:138 [inline] el0_svc+0xf0/0x1e0 arch/arm64/kernel/entry-common.c:609 el0t_64_sync_handler+0xcc/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584