loop5: detected capacity change from 0 to 32768 ====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Tainted: G L ------------------------------------------------------ syz.5.1824/16147 is trying to acquire lock: ffff88807cfd3688 (&type->i_mutex_dir_key#5){++++}-{4:4}, at: inode_lock_shared include/linux/fs.h:1042 [inline] ffff88807cfd3688 (&type->i_mutex_dir_key#5){++++}-{4:4}, at: lookup_slow+0x46/0x70 fs/namei.c:1874 but task is already holding lock: ffff88807b5eccd8 (&fs_devs->device_list_mutex){+.+.}-{4:4}, at: device_list_add+0x595/0x22b0 fs/btrfs/volumes.c:838 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:614 [inline] __mutex_lock+0x187/0x1350 kernel/locking/mutex.c:776 insert_dev_extents fs/btrfs/block-group.c:2748 [inline] btrfs_create_pending_block_groups+0x5f8/0x1760 fs/btrfs/block-group.c:2799 __btrfs_end_transaction+0x140/0x640 fs/btrfs/transaction.c:1078 flush_space+0x360/0xd20 fs/btrfs/space-info.c:898 do_async_reclaim_metadata_space+0x11e/0x350 fs/btrfs/space-info.c:1185 btrfs_async_reclaim_metadata_space+0x89/0xe0 fs/btrfs/space-info.c:1252 process_one_work kernel/workqueue.c:3257 [inline] process_scheduled_works+0xad1/0x1770 kernel/workqueue.c:3340 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3421 kthread+0x711/0x8a0 kernel/kthread.c:463 ret_from_fork+0x599/0xb30 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:246 -> #4 (btrfs_trans_num_extwriters){++++}-{0:0}: join_transaction+0x1a4/0xd60 fs/btrfs/transaction.c:323 start_transaction+0x6b7/0x15f0 fs/btrfs/transaction.c:707 btrfs_uuid_scan_kthread+0x570/0xa80 fs/btrfs/uuid-tree.c:425 kthread+0x711/0x8a0 kernel/kthread.c:463 ret_from_fork+0x599/0xb30 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:246 -> #3 (btrfs_trans_num_writers){++++}-{0:0}: __lock_release kernel/locking/lockdep.c:5574 [inline] lock_release+0x1ab/0x3b0 kernel/locking/lockdep.c:5889 percpu_up_read include/linux/percpu-rwsem.h:112 [inline] __sb_end_write include/linux/fs/super.h:14 [inline] sb_end_intwrite+0x26/0x1c0 include/linux/fs/super.h:101 __btrfs_end_transaction+0x248/0x640 fs/btrfs/transaction.c:1083 btrfs_dirty_inode+0x14c/0x190 fs/btrfs/inode.c:6337 inode_update_time fs/inode.c:2167 [inline] file_update_time_flags+0x387/0x4e0 fs/inode.c:2395 btrfs_page_mkwrite+0x5c8/0x1a70 fs/btrfs/file.c:1916 do_page_mkwrite+0x14d/0x310 mm/memory.c:3528 wp_page_shared mm/memory.c:3929 [inline] do_wp_page+0x2676/0x5810 mm/memory.c:4148 handle_pte_fault mm/memory.c:6289 [inline] __handle_mm_fault mm/memory.c:6411 [inline] handle_mm_fault+0x14c5/0x32b0 mm/memory.c:6580 do_user_addr_fault+0xa7c/0x1380 arch/x86/mm/fault.c:1336 handle_page_fault arch/x86/mm/fault.c:1476 [inline] exc_page_fault+0x82/0x100 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:618 -> #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/super.h:19 [inline] sb_start_pagefault include/linux/fs/super.h:159 [inline] btrfs_page_mkwrite+0x317/0x1a70 fs/btrfs/file.c:1875 do_page_mkwrite+0x14d/0x310 mm/memory.c:3528 wp_page_shared mm/memory.c:3929 [inline] do_wp_page+0x2676/0x5810 mm/memory.c:4148 handle_pte_fault mm/memory.c:6289 [inline] __handle_mm_fault mm/memory.c:6411 [inline] handle_mm_fault+0x14c5/0x32b0 mm/memory.c:6580 do_user_addr_fault+0x764/0x1380 arch/x86/mm/fault.c:1387 handle_page_fault arch/x86/mm/fault.c:1476 [inline] exc_page_fault+0x82/0x100 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:618 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:206 [inline] _copy_to_user+0x85/0xb0 lib/usercopy.c:26 copy_to_user include/linux/uaccess.h:236 [inline] __do_sys_copy_file_range fs/read_write.c:1695 [inline] __se_sys_copy_file_range+0x3d0/0x470 fs/read_write.c:1648 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (&mm->mmap_lock){++++}-{4:4}: down_read_killable+0x50/0x350 kernel/locking/rwsem.c:1560 mmap_read_lock_killable+0x1d/0x70 include/linux/mmap_lock.h:400 get_mmap_lock_carefully mm/mmap_lock.c:399 [inline] lock_mm_and_find_vma+0x2a8/0x300 mm/mmap_lock.c:450 do_user_addr_fault+0x331/0x1380 arch/x86/mm/fault.c:1359 handle_page_fault arch/x86/mm/fault.c:1476 [inline] exc_page_fault+0x82/0x100 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:618 user_access_begin arch/x86/include/asm/uaccess.h:-1 [inline] filldir+0x29c/0x6c0 fs/readdir.c:290 dir_emit_dot include/linux/fs.h:3531 [inline] dir_emit_dots include/linux/fs.h:3542 [inline] offset_readdir+0x1e6/0x560 fs/libfs.c:569 iterate_dir+0x399/0x570 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/0xf80 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+0x15a6/0x2cf0 kernel/locking/lockdep.c:5237 lock_acquire+0x117/0x340 kernel/locking/lockdep.c:5868 down_read+0x47/0x2e0 kernel/locking/rwsem.c:1537 inode_lock_shared include/linux/fs.h:1042 [inline] lookup_slow+0x46/0x70 fs/namei.c:1874 walk_component fs/namei.c:2221 [inline] lookup_last fs/namei.c:2722 [inline] path_lookupat+0x3f5/0x8c0 fs/namei.c:2746 filename_lookup+0x212/0x570 fs/namei.c:2775 kern_path+0x35/0x50 fs/namei.c:2987 is_same_device fs/btrfs/volumes.c:759 [inline] device_list_add+0xe21/0x22b0 fs/btrfs/volumes.c:893 btrfs_scan_one_device+0x3ef/0x680 fs/btrfs/volumes.c:1492 btrfs_get_tree_super fs/btrfs/super.c:1860 [inline] btrfs_get_tree_subvol fs/btrfs/super.c:2089 [inline] btrfs_get_tree+0x4ab/0x1920 fs/btrfs/super.c:2123 vfs_get_tree+0x92/0x2a0 fs/super.c:1751 fc_mount fs/namespace.c:1199 [inline] do_new_mount_fc fs/namespace.c:3636 [inline] do_new_mount+0x302/0xa10 fs/namespace.c:3712 do_mount fs/namespace.c:4035 [inline] __do_sys_mount fs/namespace.c:4224 [inline] __se_sys_mount+0x313/0x410 fs/namespace.c:4201 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xf80 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.5.1824/16147: #0: ffffffff8e513288 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree_super fs/btrfs/super.c:1854 [inline] #0: ffffffff8e513288 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree_subvol fs/btrfs/super.c:2089 [inline] #0: ffffffff8e513288 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree+0x47c/0x1920 fs/btrfs/super.c:2123 #1: ffff88807b5eccd8 (&fs_devs->device_list_mutex){+.+.}-{4:4}, at: device_list_add+0x595/0x22b0 fs/btrfs/volumes.c:838 stack backtrace: CPU: 1 UID: 0 PID: 16147 Comm: syz.5.1824 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025 Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_circular_bug+0x2e2/0x300 kernel/locking/lockdep.c:2043 check_noncircular+0x12e/0x150 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+0x15a6/0x2cf0 kernel/locking/lockdep.c:5237 lock_acquire+0x117/0x340 kernel/locking/lockdep.c:5868 down_read+0x47/0x2e0 kernel/locking/rwsem.c:1537 inode_lock_shared include/linux/fs.h:1042 [inline] lookup_slow+0x46/0x70 fs/namei.c:1874 walk_component fs/namei.c:2221 [inline] lookup_last fs/namei.c:2722 [inline] path_lookupat+0x3f5/0x8c0 fs/namei.c:2746 filename_lookup+0x212/0x570 fs/namei.c:2775 kern_path+0x35/0x50 fs/namei.c:2987 is_same_device fs/btrfs/volumes.c:759 [inline] device_list_add+0xe21/0x22b0 fs/btrfs/volumes.c:893 btrfs_scan_one_device+0x3ef/0x680 fs/btrfs/volumes.c:1492 btrfs_get_tree_super fs/btrfs/super.c:1860 [inline] btrfs_get_tree_subvol fs/btrfs/super.c:2089 [inline] btrfs_get_tree+0x4ab/0x1920 fs/btrfs/super.c:2123 vfs_get_tree+0x92/0x2a0 fs/super.c:1751 fc_mount fs/namespace.c:1199 [inline] do_new_mount_fc fs/namespace.c:3636 [inline] do_new_mount+0x302/0xa10 fs/namespace.c:3712 do_mount fs/namespace.c:4035 [inline] __do_sys_mount fs/namespace.c:4224 [inline] __se_sys_mount+0x313/0x410 fs/namespace.c:4201 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f7793390eea 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:00007f779426fe68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007f779426fef0 RCX: 00007f7793390eea RDX: 0000200000000200 RSI: 0000200000005600 RDI: 00007f779426feb0 RBP: 0000200000000200 R08: 00007f779426fef0 R09: 0000000000000800 R10: 0000000000000800 R11: 0000000000000246 R12: 0000200000005600 R13: 00007f779426feb0 R14: 000000000000559e R15: 0000200000000740 BTRFS info (device loop5): first mount of filesystem 395ef67a-297e-477c-816d-cd80a5b93e5d BTRFS info (device loop5): using sha256 (sha256-lib) checksum algorithm BTRFS info (device loop5): enabling ssd optimizations BTRFS info (device loop5): turning on async discard BTRFS info (device loop5): enabling free space tree