loop2: detected capacity change from 0 to 32768 ====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.2.192/7200 is trying to acquire lock: ffff8880623e3538 (&type->i_mutex_dir_key#5){++++}-{4:4}, at: inode_lock_shared include/linux/fs.h:885 [inline] ffff8880623e3538 (&type->i_mutex_dir_key#5){++++}-{4:4}, at: lookup_slow+0x46/0x70 fs/namei.c:1824 but task is already holding lock: ffff8880671eb8c8 (&fs_devs->device_list_mutex){+.+.}-{4:4}, at: device_list_add+0x595/0x22a0 fs/btrfs/volumes.c:839 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #5 (&fs_devs->device_list_mutex){+.+.}-{4:4}: lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868 __mutex_lock_common kernel/locking/rtmutex_api.c:535 [inline] mutex_lock_nested+0x5a/0x1d0 kernel/locking/rtmutex_api.c:547 btrfs_run_dev_stats+0x102/0x10e0 fs/btrfs/volumes.c:7777 commit_cowonly_roots+0x1b2/0x860 fs/btrfs/transaction.c:1348 btrfs_commit_transaction+0xfc7/0x3950 fs/btrfs/transaction.c:2462 btrfs_rebuild_free_space_tree+0x285/0x760 fs/btrfs/free-space-tree.c:1384 btrfs_start_pre_rw_mount+0x128f/0x1bf0 fs/btrfs/disk-io.c:3075 open_ctree+0x293a/0x3a10 fs/btrfs/disk-io.c:3617 btrfs_fill_super fs/btrfs/super.c:980 [inline] btrfs_get_tree_super fs/btrfs/super.c:1943 [inline] btrfs_get_tree_subvol fs/btrfs/super.c:2080 [inline] btrfs_get_tree+0xf55/0x1820 fs/btrfs/super.c:2114 vfs_get_tree+0x8f/0x2b0 fs/super.c:1815 do_new_mount+0x2a2/0x9e0 fs/namespace.c:3808 do_mount fs/namespace.c:4136 [inline] __do_sys_mount fs/namespace.c:4347 [inline] __se_sys_mount+0x317/0x410 fs/namespace.c:4324 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #4 (&fs_info->reloc_mutex){+.+.}-{4:4}: lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868 __mutex_lock_common kernel/locking/rtmutex_api.c:535 [inline] mutex_lock_nested+0x5a/0x1d0 kernel/locking/rtmutex_api.c:547 btrfs_record_root_in_trans+0x14f/0x180 fs/btrfs/transaction.c:503 start_transaction+0x3a4/0x1620 fs/btrfs/transaction.c:779 btrfs_create_common+0x145/0x230 fs/btrfs/inode.c:6759 lookup_open fs/namei.c:3708 [inline] open_last_lookups fs/namei.c:3807 [inline] path_openat+0x1500/0x3840 fs/namei.c:4043 do_filp_open+0x1fa/0x410 fs/namei.c:4073 do_sys_openat2+0x121/0x1c0 fs/open.c:1435 do_sys_open fs/open.c:1450 [inline] __do_sys_open fs/open.c:1458 [inline] __se_sys_open fs/open.c:1454 [inline] __x64_sys_open+0x11e/0x150 fs/open.c:1454 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #3 (btrfs_trans_num_extwriters){++++}-{0:0}: lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868 join_transaction+0x1a4/0xca0 fs/btrfs/transaction.c:321 start_transaction+0x6b6/0x1620 fs/btrfs/transaction.c:705 btrfs_rebuild_free_space_tree+0xad/0x760 fs/btrfs/free-space-tree.c:1339 btrfs_start_pre_rw_mount+0x128f/0x1bf0 fs/btrfs/disk-io.c:3075 open_ctree+0x293a/0x3a10 fs/btrfs/disk-io.c:3617 btrfs_fill_super fs/btrfs/super.c:980 [inline] btrfs_get_tree_super fs/btrfs/super.c:1943 [inline] btrfs_get_tree_subvol fs/btrfs/super.c:2080 [inline] btrfs_get_tree+0xf55/0x1820 fs/btrfs/super.c:2114 vfs_get_tree+0x8f/0x2b0 fs/super.c:1815 do_new_mount+0x2a2/0x9e0 fs/namespace.c:3808 do_mount fs/namespace.c:4136 [inline] __do_sys_mount fs/namespace.c:4347 [inline] __se_sys_mount+0x317/0x410 fs/namespace.c:4324 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #2 (btrfs_trans_num_writers){++++}-{0:0}: reacquire_held_locks+0x127/0x1d0 kernel/locking/lockdep.c:5385 __lock_release kernel/locking/lockdep.c:5574 [inline] lock_release+0x1b4/0x3e0 kernel/locking/lockdep.c:5889 percpu_up_read include/linux/percpu-rwsem.h:112 [inline] __sb_end_write include/linux/fs.h:1794 [inline] sb_end_intwrite+0x26/0x1c0 include/linux/fs.h:1911 __btrfs_end_transaction+0x248/0x640 fs/btrfs/transaction.c:1076 btrfs_dirty_inode+0x14c/0x190 fs/btrfs/inode.c:6259 inode_update_time fs/inode.c:2075 [inline] __file_update_time fs/inode.c:2304 [inline] file_update_time+0x34d/0x490 fs/inode.c:2334 btrfs_page_mkwrite+0x5dd/0x1a80 fs/btrfs/file.c:1916 do_page_mkwrite+0x14d/0x310 mm/memory.c:3361 do_shared_fault mm/memory.c:5649 [inline] do_fault mm/memory.c:5711 [inline] do_pte_missing mm/memory.c:4234 [inline] handle_pte_fault mm/memory.c:6052 [inline] __handle_mm_fault mm/memory.c:6195 [inline] handle_mm_fault+0x124b/0x3400 mm/memory.c:6364 do_user_addr_fault+0x764/0x1390 arch/x86/mm/fault.c:1387 handle_page_fault arch/x86/mm/fault.c:1476 [inline] exc_page_fault+0x76/0xf0 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 -> #1 (sb_pagefaults#4){.+.+}-{0:0}: lock_acquire+0x120/0x360 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.h:1799 [inline] sb_start_pagefault include/linux/fs.h:1964 [inline] btrfs_page_mkwrite+0x32c/0x1a80 fs/btrfs/file.c:1875 do_page_mkwrite+0x14d/0x310 mm/memory.c:3361 do_shared_fault mm/memory.c:5649 [inline] do_fault mm/memory.c:5711 [inline] do_pte_missing mm/memory.c:4234 [inline] handle_pte_fault mm/memory.c:6052 [inline] __handle_mm_fault mm/memory.c:6195 [inline] handle_mm_fault+0x124b/0x3400 mm/memory.c:6364 do_user_addr_fault+0x764/0x1390 arch/x86/mm/fault.c:1387 handle_page_fault arch/x86/mm/fault.c:1476 [inline] exc_page_fault+0x76/0xf0 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 user_access_begin arch/x86/include/asm/uaccess.h:-1 [inline] filldir+0x2a2/0x6c0 fs/readdir.c:290 dir_emit_dot include/linux/fs.h:3963 [inline] dir_emit_dots include/linux/fs.h:3974 [inline] offset_readdir+0x1e3/0x560 fs/libfs.c:569 iterate_dir+0x3a5/0x580 fs/readdir.c:108 __do_sys_getdents fs/readdir.c:326 [inline] __se_sys_getdents+0xe4/0x250 fs/readdir.c:312 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&type->i_mutex_dir_key#5){++++}-{4:4}: check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3908 __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5237 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868 down_read+0x97/0x1f0 kernel/locking/rwsem.c:1537 inode_lock_shared include/linux/fs.h:885 [inline] lookup_slow+0x46/0x70 fs/namei.c:1824 walk_component+0x2d2/0x400 fs/namei.c:2129 lookup_last fs/namei.c:2630 [inline] path_lookupat+0x163/0x430 fs/namei.c:2654 filename_lookup+0x212/0x570 fs/namei.c:2683 kern_path+0x35/0x50 fs/namei.c:2816 is_same_device fs/btrfs/volumes.c:759 [inline] device_list_add+0xe2a/0x22a0 fs/btrfs/volumes.c:894 btrfs_scan_one_device+0x3ee/0x650 fs/btrfs/volumes.c:1493 btrfs_get_tree_super fs/btrfs/super.c:1856 [inline] btrfs_get_tree_subvol fs/btrfs/super.c:2080 [inline] btrfs_get_tree+0x433/0x1820 fs/btrfs/super.c:2114 vfs_get_tree+0x8f/0x2b0 fs/super.c:1815 do_new_mount+0x2a2/0x9e0 fs/namespace.c:3808 do_mount fs/namespace.c:4136 [inline] __do_sys_mount fs/namespace.c:4347 [inline] __se_sys_mount+0x317/0x410 fs/namespace.c:4324 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 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: &type->i_mutex_dir_key#5 --> &fs_info->reloc_mutex --> &fs_devs->device_list_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&fs_devs->device_list_mutex); lock(&fs_info->reloc_mutex); lock(&fs_devs->device_list_mutex); rlock(&type->i_mutex_dir_key#5); *** DEADLOCK *** 2 locks held by syz.2.192/7200: #0: ffffffff8df49ed8 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree_super fs/btrfs/super.c:1850 [inline] #0: ffffffff8df49ed8 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree_subvol fs/btrfs/super.c:2080 [inline] #0: ffffffff8df49ed8 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree+0x408/0x1820 fs/btrfs/super.c:2114 #1: ffff8880671eb8c8 (&fs_devs->device_list_mutex){+.+.}-{4:4}, at: device_list_add+0x595/0x22a0 fs/btrfs/volumes.c:839 stack backtrace: CPU: 0 UID: 0 PID: 7200 Comm: syz.2.192 Not tainted syzkaller #0 PREEMPT_{RT,(full)} Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025 Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_circular_bug+0x2ee/0x310 kernel/locking/lockdep.c:2043 check_noncircular+0x134/0x160 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+0xb9b/0x2140 kernel/locking/lockdep.c:3908 __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5237 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868 down_read+0x97/0x1f0 kernel/locking/rwsem.c:1537 inode_lock_shared include/linux/fs.h:885 [inline] lookup_slow+0x46/0x70 fs/namei.c:1824 walk_component+0x2d2/0x400 fs/namei.c:2129 lookup_last fs/namei.c:2630 [inline] path_lookupat+0x163/0x430 fs/namei.c:2654 filename_lookup+0x212/0x570 fs/namei.c:2683 kern_path+0x35/0x50 fs/namei.c:2816 is_same_device fs/btrfs/volumes.c:759 [inline] device_list_add+0xe2a/0x22a0 fs/btrfs/volumes.c:894 btrfs_scan_one_device+0x3ee/0x650 fs/btrfs/volumes.c:1493 btrfs_get_tree_super fs/btrfs/super.c:1856 [inline] btrfs_get_tree_subvol fs/btrfs/super.c:2080 [inline] btrfs_get_tree+0x433/0x1820 fs/btrfs/super.c:2114 vfs_get_tree+0x8f/0x2b0 fs/super.c:1815 do_new_mount+0x2a2/0x9e0 fs/namespace.c:3808 do_mount fs/namespace.c:4136 [inline] __do_sys_mount fs/namespace.c:4347 [inline] __se_sys_mount+0x317/0x410 fs/namespace.c:4324 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fc48b62034a Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 1a 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 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:00007fc489885e68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007fc489885ef0 RCX: 00007fc48b62034a RDX: 0000200000000000 RSI: 00002000000015c0 RDI: 00007fc489885eb0 RBP: 0000200000000000 R08: 00007fc489885ef0 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00002000000015c0 R13: 00007fc489885eb0 R14: 000000000000559e R15: 0000200000001600 BTRFS info (device loop2): first mount of filesystem 395ef67a-297e-477c-816d-cd80a5b93e5d BTRFS info (device loop2): using sha256 (sha256-lib) checksum algorithm BTRFS info (device loop2): enabling ssd optimizations BTRFS info (device loop2): enabling free space tree BTRFS info (device loop2): Snapshot src from another FS