loop0: detected capacity change from 0 to 32768 ====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.0.3908/16426 is trying to acquire lock: ffff88803357dd58 (&type->i_mutex_dir_key#5){++++}-{4:4}, at: inode_lock_shared include/linux/fs.h:994 [inline] ffff88803357dd58 (&type->i_mutex_dir_key#5){++++}-{4:4}, at: lookup_slow fs/namei.c:1832 [inline] ffff88803357dd58 (&type->i_mutex_dir_key#5){++++}-{4:4}, at: walk_component+0x345/0x5b0 fs/namei.c:2151 but task is already holding lock: ffff888069a03cd8 (&fs_devs->device_list_mutex){+.+.}-{4:4}, at: device_list_add.constprop.0+0x568/0x2860 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}: __mutex_lock_common kernel/locking/mutex.c:598 [inline] __mutex_lock+0x193/0x1060 kernel/locking/mutex.c:760 insert_dev_extents fs/btrfs/block-group.c:2754 [inline] btrfs_create_pending_block_groups+0x771/0x1990 fs/btrfs/block-group.c:2805 __btrfs_end_transaction+0xf5/0x920 fs/btrfs/transaction.c:1071 flush_space+0x887/0xe40 fs/btrfs/space-info.c:865 do_async_reclaim_metadata_space+0x18d/0x3e0 fs/btrfs/space-info.c:1158 btrfs_async_reclaim_metadata_space+0xd0/0x160 fs/btrfs/space-info.c:1226 process_one_work+0x9cf/0x1b70 kernel/workqueue.c:3236 process_scheduled_works kernel/workqueue.c:3319 [inline] worker_thread+0x6c8/0xf10 kernel/workqueue.c:3400 kthread+0x3c5/0x780 kernel/kthread.c:463 ret_from_fork+0x56d/0x730 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #4 (btrfs_trans_num_extwriters){++++}-{0:0}: join_transaction+0x165/0x1020 fs/btrfs/transaction.c:321 start_transaction+0x430/0x1b00 fs/btrfs/transaction.c:705 btrfs_rebuild_free_space_tree+0xad/0x870 fs/btrfs/free-space-tree.c:1339 btrfs_start_pre_rw_mount+0x290/0x1ce0 fs/btrfs/disk-io.c:3075 open_ctree+0x6b82/0x7550 fs/btrfs/disk-io.c:3617 btrfs_fill_super fs/btrfs/super.c:991 [inline] btrfs_get_tree_super fs/btrfs/super.c:1954 [inline] btrfs_get_tree_subvol fs/btrfs/super.c:2091 [inline] btrfs_get_tree+0x1368/0x26f0 fs/btrfs/super.c:2125 vfs_get_tree+0x8e/0x340 fs/super.c:1752 do_new_mount fs/namespace.c:3750 [inline] path_mount+0x1516/0x2060 fs/namespace.c:4065 do_mount fs/namespace.c:4078 [inline] __do_sys_mount fs/namespace.c:4278 [inline] __se_sys_mount fs/namespace.c:4255 [inline] __x64_sys_mount+0x28d/0x310 fs/namespace.c:4255 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4e0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #3 (btrfs_trans_num_writers){++++}-{0:0}: __lock_release kernel/locking/lockdep.c:5574 [inline] lock_release+0x13b/0x2f0 kernel/locking/lockdep.c:5889 percpu_up_read include/linux/percpu-rwsem.h:112 [inline] __sb_end_write include/linux/fs.h:1903 [inline] sb_end_intwrite include/linux/fs.h:2020 [inline] __btrfs_end_transaction+0x5c7/0x920 fs/btrfs/transaction.c:1076 btrfs_dirty_inode+0x131/0x200 fs/btrfs/inode.c:6258 btrfs_update_time fs/btrfs/inode.c:6278 [inline] btrfs_update_time+0xb2/0xf0 fs/btrfs/inode.c:6269 inode_update_time fs/inode.c:2117 [inline] __file_update_time fs/inode.c:2345 [inline] file_update_time+0x14b/0x1c0 fs/inode.c:2375 btrfs_page_mkwrite+0x52e/0x1dc0 fs/btrfs/file.c:1916 do_page_mkwrite+0x174/0x380 mm/memory.c:3361 wp_page_shared mm/memory.c:3762 [inline] do_wp_page+0xb10/0x4f00 mm/memory.c:3981 handle_pte_fault mm/memory.c:6068 [inline] __handle_mm_fault+0x1b2d/0x2a50 mm/memory.c:6195 handle_mm_fault+0x589/0xd10 mm/memory.c:6364 do_user_addr_fault+0x7a6/0x1370 arch/x86/mm/fault.c:1387 handle_page_fault arch/x86/mm/fault.c:1476 [inline] exc_page_fault+0x5c/0xb0 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 copy_user_generic arch/x86/include/asm/uaccess_64.h:126 [inline] raw_copy_to_user arch/x86/include/asm/uaccess_64.h:147 [inline] _inline_copy_to_user include/linux/uaccess.h:197 [inline] _copy_to_user+0xb6/0xd0 lib/usercopy.c:26 copy_to_user include/linux/uaccess.h:225 [inline] ioctl_fiemap fs/ioctl.c:224 [inline] do_vfs_ioctl+0x467/0x14f0 fs/ioctl.c:531 __do_sys_ioctl fs/ioctl.c:595 [inline] __se_sys_ioctl fs/ioctl.c:583 [inline] __x64_sys_ioctl+0x114/0x210 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4e0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #2 (sb_pagefaults#6){.+.+}-{0:0}: 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:1908 [inline] sb_start_pagefault include/linux/fs.h:2073 [inline] btrfs_page_mkwrite+0x2e2/0x1dc0 fs/btrfs/file.c:1875 do_page_mkwrite+0x174/0x380 mm/memory.c:3361 wp_page_shared mm/memory.c:3762 [inline] do_wp_page+0xb10/0x4f00 mm/memory.c:3981 handle_pte_fault mm/memory.c:6068 [inline] __handle_mm_fault+0x1b2d/0x2a50 mm/memory.c:6195 handle_mm_fault+0x589/0xd10 mm/memory.c:6364 do_user_addr_fault+0x7a6/0x1370 arch/x86/mm/fault.c:1387 handle_page_fault arch/x86/mm/fault.c:1476 [inline] exc_page_fault+0x5c/0xb0 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 copy_user_generic arch/x86/include/asm/uaccess_64.h:126 [inline] raw_copy_to_user arch/x86/include/asm/uaccess_64.h:147 [inline] _inline_copy_to_user include/linux/uaccess.h:197 [inline] _copy_to_user+0xb6/0xd0 lib/usercopy.c:26 copy_to_user include/linux/uaccess.h:225 [inline] ioctl_fiemap fs/ioctl.c:224 [inline] do_vfs_ioctl+0x467/0x14f0 fs/ioctl.c:531 __do_sys_ioctl fs/ioctl.c:595 [inline] __se_sys_ioctl fs/ioctl.c:583 [inline] __x64_sys_ioctl+0x114/0x210 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4e0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (&mm->mmap_lock){++++}-{4:4}: down_write_killable+0x95/0x250 kernel/locking/rwsem.c:1601 mmap_write_lock_killable include/linux/mmap_lock.h:415 [inline] upgrade_mmap_lock_carefully mm/mmap_lock.c:310 [inline] lock_mm_and_find_vma+0x1af/0x6e0 mm/mmap_lock.c:363 do_user_addr_fault+0x2ac/0x1370 arch/x86/mm/fault.c:1359 handle_page_fault arch/x86/mm/fault.c:1476 [inline] exc_page_fault+0x5c/0xb0 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 filldir+0x1d3/0x600 fs/readdir.c:294 dir_emit_dot include/linux/fs.h:3955 [inline] dir_emit_dots include/linux/fs.h:3966 [inline] offset_readdir+0x1c7/0x6d0 fs/libfs.c:569 iterate_dir+0x296/0xaf0 fs/readdir.c:108 __do_sys_getdents fs/readdir.c:326 [inline] __se_sys_getdents fs/readdir.c:312 [inline] __x64_sys_getdents+0x13c/0x2b0 fs/readdir.c:312 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4e0 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 kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x12a6/0x1ce0 kernel/locking/lockdep.c:5237 lock_acquire kernel/locking/lockdep.c:5868 [inline] lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5825 down_read+0x9b/0x480 kernel/locking/rwsem.c:1537 inode_lock_shared include/linux/fs.h:994 [inline] lookup_slow fs/namei.c:1832 [inline] walk_component+0x345/0x5b0 fs/namei.c:2151 lookup_last fs/namei.c:2652 [inline] path_lookupat+0x142/0x6d0 fs/namei.c:2676 filename_lookup+0x224/0x5f0 fs/namei.c:2705 kern_path+0x35/0x50 fs/namei.c:2863 is_same_device fs/btrfs/volumes.c:759 [inline] device_list_add.constprop.0+0x7e3/0x2860 fs/btrfs/volumes.c:894 btrfs_scan_one_device+0x30d/0x7f0 fs/btrfs/volumes.c:1493 btrfs_get_tree_super fs/btrfs/super.c:1867 [inline] btrfs_get_tree_subvol fs/btrfs/super.c:2091 [inline] btrfs_get_tree+0x5a0/0x26f0 fs/btrfs/super.c:2125 vfs_get_tree+0x8e/0x340 fs/super.c:1752 do_new_mount fs/namespace.c:3750 [inline] path_mount+0x1516/0x2060 fs/namespace.c:4065 do_mount fs/namespace.c:4078 [inline] __do_sys_mount fs/namespace.c:4278 [inline] __se_sys_mount fs/namespace.c:4255 [inline] __x64_sys_mount+0x28d/0x310 fs/namespace.c:4255 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4e0 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 --> btrfs_trans_num_extwriters --> &fs_devs->device_list_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&fs_devs->device_list_mutex); lock(btrfs_trans_num_extwriters); lock(&fs_devs->device_list_mutex); rlock(&type->i_mutex_dir_key#5); *** DEADLOCK *** 2 locks held by syz.0.3908/16426: #0: ffffffff8e9d3dc8 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree_super fs/btrfs/super.c:1861 [inline] #0: ffffffff8e9d3dc8 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree_subvol fs/btrfs/super.c:2091 [inline] #0: ffffffff8e9d3dc8 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree+0x56d/0x26f0 fs/btrfs/super.c:2125 #1: ffff888069a03cd8 (&fs_devs->device_list_mutex){+.+.}-{4:4}, at: device_list_add.constprop.0+0x568/0x2860 fs/btrfs/volumes.c:839 stack backtrace: CPU: 0 UID: 0 PID: 16426 Comm: syz.0.3908 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_circular_bug+0x275/0x350 kernel/locking/lockdep.c:2043 check_noncircular+0x14c/0x170 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+0x12a6/0x1ce0 kernel/locking/lockdep.c:5237 lock_acquire kernel/locking/lockdep.c:5868 [inline] lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5825 down_read+0x9b/0x480 kernel/locking/rwsem.c:1537 inode_lock_shared include/linux/fs.h:994 [inline] lookup_slow fs/namei.c:1832 [inline] walk_component+0x345/0x5b0 fs/namei.c:2151 lookup_last fs/namei.c:2652 [inline] path_lookupat+0x142/0x6d0 fs/namei.c:2676 filename_lookup+0x224/0x5f0 fs/namei.c:2705 kern_path+0x35/0x50 fs/namei.c:2863 is_same_device fs/btrfs/volumes.c:759 [inline] device_list_add.constprop.0+0x7e3/0x2860 fs/btrfs/volumes.c:894 btrfs_scan_one_device+0x30d/0x7f0 fs/btrfs/volumes.c:1493 btrfs_get_tree_super fs/btrfs/super.c:1867 [inline] btrfs_get_tree_subvol fs/btrfs/super.c:2091 [inline] btrfs_get_tree+0x5a0/0x26f0 fs/btrfs/super.c:2125 vfs_get_tree+0x8e/0x340 fs/super.c:1752 do_new_mount fs/namespace.c:3750 [inline] path_mount+0x1516/0x2060 fs/namespace.c:4065 do_mount fs/namespace.c:4078 [inline] __do_sys_mount fs/namespace.c:4278 [inline] __se_sys_mount fs/namespace.c:4255 [inline] __x64_sys_mount+0x28d/0x310 fs/namespace.c:4255 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4e0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f63b5b9066a 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:00007f63b69a9e68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007f63b69a9ef0 RCX: 00007f63b5b9066a RDX: 0000200000000000 RSI: 00002000000015c0 RDI: 00007f63b69a9eb0 RBP: 0000200000000000 R08: 00007f63b69a9ef0 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00002000000015c0 R13: 00007f63b69a9eb0 R14: 000000000000559e R15: 0000200000000440 BTRFS info (device loop0): first mount of filesystem 395ef67a-297e-477c-816d-cd80a5b93e5d BTRFS info (device loop0): using sha256 (sha256-lib) checksum algorithm BTRFS warning (device loop0): space cache v1 is being deprecated and will be removed in a future release, please use -o space_cache=v2 BTRFS info (device loop0): rebuilding free space tree BTRFS info (device loop0): disabling free space tree BTRFS info (device loop0): clearing compat-ro feature flag for FREE_SPACE_TREE (0x1) BTRFS info (device loop0): clearing compat-ro feature flag for FREE_SPACE_TREE_VALID (0x2) BTRFS info (device loop0): enabling ssd optimizations BTRFS info (device loop0): enabling disk space caching BTRFS info (device loop0): force clearing of disk cache BTRFS info (device loop0): enabling auto defrag BTRFS info (device loop0): force zlib compression, level 3