loop6: detected capacity change from 0 to 32768 ====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.6.6090/30592 is trying to acquire lock: ffff88805b6663d0 (&type->i_mutex_dir_key#5){++++}-{4:4}, at: inode_lock_shared include/linux/fs.h:995 [inline] ffff88805b6663d0 (&type->i_mutex_dir_key#5){++++}-{4:4}, at: lookup_slow+0x46/0x70 fs/namei.c:1832 but task is already holding lock: ffff88802f33ecd8 (&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: -> #4 (&fs_devs->device_list_mutex){+.+.}-{4:4}: lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868 __mutex_lock_common kernel/locking/mutex.c:598 [inline] __mutex_lock+0x187/0x1350 kernel/locking/mutex.c:760 insert_dev_extents fs/btrfs/block-group.c:2754 [inline] btrfs_create_pending_block_groups+0x5f8/0x1780 fs/btrfs/block-group.c:2805 __btrfs_end_transaction+0x140/0x640 fs/btrfs/transaction.c:1071 btrfs_inc_block_group_ro+0x641/0x6f0 fs/btrfs/block-group.c:3092 btrfs_relocate_block_group+0x3f1/0xc60 fs/btrfs/relocation.c:3935 btrfs_relocate_chunk+0x12f/0x5c0 fs/btrfs/volumes.c:3451 __btrfs_balance+0x1860/0x23f0 fs/btrfs/volumes.c:4227 btrfs_balance+0xac2/0x11b0 fs/btrfs/volumes.c:4604 btrfs_ioctl_balance+0x3d3/0x610 fs/btrfs/ioctl.c:3577 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xfa0 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/0xd70 fs/btrfs/transaction.c:321 start_transaction+0x6b6/0x1620 fs/btrfs/transaction.c:705 btrfs_dirty_inode+0x9f/0x190 fs/btrfs/inode.c:6270 inode_update_time fs/inode.c:2117 [inline] touch_atime+0x2f9/0x6d0 fs/inode.c:2190 file_accessed include/linux/fs.h:2673 [inline] filemap_read+0x1002/0x11a0 mm/filemap.c:2820 __kernel_read+0x4cf/0x960 fs/read_write.c:530 integrity_kernel_read+0x89/0xd0 security/integrity/iint.c:28 ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:480 [inline] ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline] ima_calc_file_hash+0x85e/0x16f0 security/integrity/ima/ima_crypto.c:568 ima_collect_measurement+0x428/0x8f0 security/integrity/ima/ima_api.c:293 process_measurement+0x1121/0x1a40 security/integrity/ima/ima_main.c:405 ima_file_check+0xd7/0x120 security/integrity/ima/ima_main.c:633 security_file_post_open+0xbb/0x290 security/security.c:3199 do_open fs/namei.c:3977 [inline] path_openat+0x2f26/0x3830 fs/namei.c:4134 do_filp_open+0x1fa/0x410 fs/namei.c:4161 do_sys_openat2+0x121/0x1c0 fs/open.c:1437 do_sys_open fs/open.c:1452 [inline] __do_sys_openat fs/open.c:1468 [inline] __se_sys_openat fs/open.c:1463 [inline] __x64_sys_openat+0x138/0x170 fs/open.c:1463 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xfa0 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:1911 [inline] sb_end_intwrite+0x26/0x1c0 include/linux/fs.h:2028 __btrfs_end_transaction+0x248/0x640 fs/btrfs/transaction.c:1076 btrfs_dirty_inode+0x14c/0x190 fs/btrfs/inode.c:6284 inode_update_time fs/inode.c:2117 [inline] touch_atime+0x2f9/0x6d0 fs/inode.c:2190 file_accessed include/linux/fs.h:2673 [inline] btrfs_file_mmap_prepare+0xd5/0x140 fs/btrfs/file.c:2049 vfs_mmap_prepare include/linux/fs.h:2410 [inline] call_mmap_prepare mm/vma.c:2586 [inline] __mmap_region mm/vma.c:2654 [inline] mmap_region+0xb47/0x2110 mm/vma.c:2740 do_mmap+0xc45/0x10d0 mm/mmap.c:558 vm_mmap_pgoff+0x2a6/0x4d0 mm/util.c:580 ksys_mmap_pgoff+0x51f/0x760 mm/mmap.c:604 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (&mm->mmap_lock){++++}-{4:4}: lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868 down_write_killable+0xa7/0x230 kernel/locking/rwsem.c:1601 mmap_write_lock_killable include/linux/mmap_lock.h:330 [inline] upgrade_mmap_lock_carefully+0xba/0x1c0 mm/mmap_lock.c:401 lock_mm_and_find_vma+0x10a/0x300 mm/mmap_lock.c:454 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 filldir64+0x2c1/0x690 fs/readdir.c:-1 dir_emit include/linux/fs.h:3987 [inline] offset_dir_emit fs/libfs.c:507 [inline] offset_iterate_dir fs/libfs.c:523 [inline] offset_readdir+0x44c/0x560 fs/libfs.c:572 iterate_dir+0x399/0x570 fs/readdir.c:108 __do_sys_getdents64 fs/readdir.c:410 [inline] __se_sys_getdents64+0xe4/0x260 fs/readdir.c:396 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xfa0 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+0x46/0x2e0 kernel/locking/rwsem.c:1537 inode_lock_shared include/linux/fs.h:995 [inline] lookup_slow+0x46/0x70 fs/namei.c:1832 walk_component+0x2d2/0x400 fs/namei.c:2151 lookup_last fs/namei.c:2652 [inline] path_lookupat+0x163/0x430 fs/namei.c:2676 filename_lookup+0x212/0x570 fs/namei.c:2705 kern_path+0x35/0x50 fs/namei.c:2863 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:1865 [inline] btrfs_get_tree_subvol fs/btrfs/super.c:2089 [inline] btrfs_get_tree+0x438/0x1830 fs/btrfs/super.c:2123 vfs_get_tree+0x92/0x2b0 fs/super.c:1751 fc_mount fs/namespace.c:1208 [inline] do_new_mount_fc fs/namespace.c:3651 [inline] do_new_mount+0x302/0x9e0 fs/namespace.c:3725 do_mount fs/namespace.c:4048 [inline] __do_sys_mount fs/namespace.c:4236 [inline] __se_sys_mount+0x313/0x410 fs/namespace.c:4213 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xfa0 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.6.6090/30592: #0: ffffffff8e2f48a8 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree_super fs/btrfs/super.c:1859 [inline] #0: ffffffff8e2f48a8 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree_subvol fs/btrfs/super.c:2089 [inline] #0: ffffffff8e2f48a8 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree+0x40d/0x1830 fs/btrfs/super.c:2123 #1: ffff88802f33ecd8 (&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: 30592 Comm: syz.6.6090 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/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+0x46/0x2e0 kernel/locking/rwsem.c:1537 inode_lock_shared include/linux/fs.h:995 [inline] lookup_slow+0x46/0x70 fs/namei.c:1832 walk_component+0x2d2/0x400 fs/namei.c:2151 lookup_last fs/namei.c:2652 [inline] path_lookupat+0x163/0x430 fs/namei.c:2676 filename_lookup+0x212/0x570 fs/namei.c:2705 kern_path+0x35/0x50 fs/namei.c:2863 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:1865 [inline] btrfs_get_tree_subvol fs/btrfs/super.c:2089 [inline] btrfs_get_tree+0x438/0x1830 fs/btrfs/super.c:2123 vfs_get_tree+0x92/0x2b0 fs/super.c:1751 fc_mount fs/namespace.c:1208 [inline] do_new_mount_fc fs/namespace.c:3651 [inline] do_new_mount+0x302/0x9e0 fs/namespace.c:3725 do_mount fs/namespace.c:4048 [inline] __do_sys_mount fs/namespace.c:4236 [inline] __se_sys_mount+0x313/0x410 fs/namespace.c:4213 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fe8a3b9066a 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:00007fe8a4a05e68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007fe8a4a05ef0 RCX: 00007fe8a3b9066a RDX: 0000200000000000 RSI: 00002000000015c0 RDI: 00007fe8a4a05eb0 RBP: 0000200000000000 R08: 00007fe8a4a05ef0 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00002000000015c0 R13: 00007fe8a4a05eb0 R14: 000000000000559e R15: 0000200000001600