BTRFS info (device loop0): using free space tree BTRFS info (device loop0): has skinny extents BTRFS info (device loop0): enabling ssd optimizations ====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.0.16/4717 is trying to acquire lock: ffff0000e27c0610 (&type->i_mutex_dir_key#8){++++}-{3:3}, at: inode_lock_shared include/linux/fs.h:797 [inline] ffff0000e27c0610 (&type->i_mutex_dir_key#8){++++}-{3:3}, at: lookup_slow+0x50/0x84 fs/namei.c:1687 but task is already holding lock: ffff0000d4b878e0 (&fs_devs->device_list_mutex){+.+.}-{3:3}, at: btrfs_free_stale_devices+0x140/0x950 fs/btrfs/volumes.c:603 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&fs_devs->device_list_mutex){+.+.}-{3:3}: __mutex_lock_common+0x1a4/0x1ea4 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0xac/0x11c kernel/locking/mutex.c:743 write_all_supers+0x10e8/0x3718 fs/btrfs/disk-io.c:4136 btrfs_sync_log+0x1734/0x1e7c fs/btrfs/tree-log.c:3341 btrfs_sync_file+0xa2c/0xf2c fs/btrfs/file.c:2371 vfs_fsync_range fs/sync.c:188 [inline] vfs_fsync fs/sync.c:202 [inline] do_fsync fs/sync.c:212 [inline] __do_sys_fdatasync fs/sync.c:225 [inline] __se_sys_fdatasync fs/sync.c:223 [inline] __arm64_sys_fdatasync+0xac/0x104 fs/sync.c:223 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x28c arch/arm64/kernel/syscall.c:52 el0_svc_common+0x13c/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x5c/0x140 arch/arm64/kernel/syscall.c:181 el0_svc+0x78/0x1d0 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 (&fs_info->tree_log_mutex){+.+.}-{3:3}: __mutex_lock_common+0x1a4/0x1ea4 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0xac/0x11c kernel/locking/mutex.c:743 btrfs_sync_log+0x1698/0x1e7c fs/btrfs/tree-log.c:3322 btrfs_sync_file+0xa2c/0xf2c fs/btrfs/file.c:2371 vfs_fsync_range fs/sync.c:188 [inline] vfs_fsync fs/sync.c:202 [inline] do_fsync fs/sync.c:212 [inline] __do_sys_fdatasync fs/sync.c:225 [inline] __se_sys_fdatasync fs/sync.c:223 [inline] __arm64_sys_fdatasync+0xac/0x104 fs/sync.c:223 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x28c arch/arm64/kernel/syscall.c:52 el0_svc_common+0x13c/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x5c/0x140 arch/arm64/kernel/syscall.c:181 el0_svc+0x78/0x1d0 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 (sb_internal#2){.+.+}-{0:0}: __lock_release kernel/locking/lockdep.c:5339 [inline] lock_release+0x2ec/0x8ec kernel/locking/lockdep.c:5643 up_write+0x98/0x644 kernel/locking/rwsem.c:1603 btrfs_inode_unlock+0x40/0x7c fs/btrfs/inode.c:142 btrfs_sync_file+0x964/0xf2c fs/btrfs/file.c:2362 vfs_fsync_range fs/sync.c:188 [inline] vfs_fsync fs/sync.c:202 [inline] do_fsync fs/sync.c:212 [inline] __do_sys_fdatasync fs/sync.c:225 [inline] __se_sys_fdatasync fs/sync.c:223 [inline] __arm64_sys_fdatasync+0xac/0x104 fs/sync.c:223 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x28c arch/arm64/kernel/syscall.c:52 el0_svc_common+0x13c/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x5c/0x140 arch/arm64/kernel/syscall.c:181 el0_svc+0x78/0x1d0 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 (&type->i_mutex_dir_key#8){++++}-{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+0x28b0/0x65d4 kernel/locking/lockdep.c:5012 lock_acquire+0x1f4/0x618 kernel/locking/lockdep.c:5623 down_read+0xc0/0x38c kernel/locking/rwsem.c:1498 inode_lock_shared include/linux/fs.h:797 [inline] lookup_slow+0x50/0x84 fs/namei.c:1687 walk_component+0x2b8/0x3b8 fs/namei.c:1984 link_path_walk+0x5a0/0xbd4 fs/namei.c:-1 path_lookupat+0xb4/0x3f0 fs/namei.c:2462 filename_lookup+0x1c8/0x478 fs/namei.c:2492 kern_path+0x4c/0x190 fs/namei.c:2590 lookup_bdev+0xc0/0x24c block/bdev.c:978 device_matched fs/btrfs/volumes.c:568 [inline] btrfs_free_stale_devices+0x614/0x950 fs/btrfs/volumes.c:608 btrfs_forget_devices+0x5c/0x98 fs/btrfs/volumes.c:1431 btrfs_control_ioctl+0x130/0x24c 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/0x28c arch/arm64/kernel/syscall.c:52 el0_svc_common+0x13c/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x5c/0x140 arch/arm64/kernel/syscall.c:181 el0_svc+0x78/0x1d0 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 other info that might help us debug this: Chain exists of: &type->i_mutex_dir_key#8 --> &fs_info->tree_log_mutex --> &fs_devs->device_list_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&fs_devs->device_list_mutex); lock(&fs_info->tree_log_mutex); lock(&fs_devs->device_list_mutex); lock(&type->i_mutex_dir_key#8); *** DEADLOCK *** 2 locks held by syz.0.16/4717: #0: ffff800014a4bc08 (uuid_mutex){+.+.}-{3:3}, at: btrfs_forget_devices+0x28/0x98 fs/btrfs/volumes.c:1430 #1: ffff0000d4b878e0 (&fs_devs->device_list_mutex){+.+.}-{3:3}, at: btrfs_free_stale_devices+0x140/0x950 fs/btrfs/volumes.c:603 stack backtrace: CPU: 0 PID: 4717 Comm: syz.0.16 Not tainted syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/02/2026 Call trace: dump_backtrace+0x0/0x458 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+0xf4/0x15c 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+0x264/0x2f8 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+0x28b0/0x65d4 kernel/locking/lockdep.c:5012 lock_acquire+0x1f4/0x618 kernel/locking/lockdep.c:5623 down_read+0xc0/0x38c kernel/locking/rwsem.c:1498 inode_lock_shared include/linux/fs.h:797 [inline] lookup_slow+0x50/0x84 fs/namei.c:1687 walk_component+0x2b8/0x3b8 fs/namei.c:1984 link_path_walk+0x5a0/0xbd4 fs/namei.c:-1 path_lookupat+0xb4/0x3f0 fs/namei.c:2462 filename_lookup+0x1c8/0x478 fs/namei.c:2492 kern_path+0x4c/0x190 fs/namei.c:2590 lookup_bdev+0xc0/0x24c block/bdev.c:978 device_matched fs/btrfs/volumes.c:568 [inline] btrfs_free_stale_devices+0x614/0x950 fs/btrfs/volumes.c:608 btrfs_forget_devices+0x5c/0x98 fs/btrfs/volumes.c:1431 btrfs_control_ioctl+0x130/0x24c 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/0x28c arch/arm64/kernel/syscall.c:52 el0_svc_common+0x13c/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x5c/0x140 arch/arm64/kernel/syscall.c:181 el0_svc+0x78/0x1d0 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