loop1: detected capacity change from 0 to 32768 ====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.1.430/9208 is trying to acquire lock: ffff88803c338418 (&type->i_mutex_dir_key#5){++++}-{4:4}, at: inode_lock_shared include/linux/fs.h:1043 [inline] ffff88803c338418 (&type->i_mutex_dir_key#5){++++}-{4:4}, at: lookup_slow+0x46/0x70 fs/namei.c:1932 but task is already holding lock: ffff8880254df0c8 (&fs_devs->device_list_mutex){+.+.}-{4:4}, at: device_list_add+0x487/0x2280 fs/btrfs/volumes.c:842 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/rtmutex_api.c:533 [inline] mutex_lock_nested+0x5a/0x1d0 kernel/locking/rtmutex_api.c:552 btrfs_run_dev_stats+0xfa/0x10f0 fs/btrfs/volumes.c:8081 commit_cowonly_roots+0x1b8/0x860 fs/btrfs/transaction.c:1359 btrfs_commit_transaction+0x1057/0x31a0 fs/btrfs/transaction.c:2502 btrfs_rebuild_free_space_tree+0x291/0x6e0 fs/btrfs/free-space-tree.c:1380 btrfs_start_pre_rw_mount+0x1529/0x1f20 fs/btrfs/disk-io.c:3071 open_ctree+0x2e07/0x4220 fs/btrfs/disk-io.c:3668 btrfs_fill_super fs/btrfs/super.c:981 [inline] btrfs_get_tree_super fs/btrfs/super.c:1944 [inline] btrfs_get_tree_subvol fs/btrfs/super.c:2087 [inline] btrfs_get_tree+0x1061/0x1930 fs/btrfs/super.c:2121 vfs_get_tree+0x92/0x2a0 fs/super.c:1754 fc_mount fs/namespace.c:1193 [inline] do_new_mount_fc fs/namespace.c:3763 [inline] do_new_mount+0x341/0xd30 fs/namespace.c:3839 do_mount fs/namespace.c:4172 [inline] __do_sys_mount fs/namespace.c:4361 [inline] __se_sys_mount+0x31d/0x420 fs/namespace.c:4338 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #4 (&fs_info->reloc_mutex){+.+.}-{4:4}: __mutex_lock_common kernel/locking/rtmutex_api.c:533 [inline] mutex_lock_nested+0x5a/0x1d0 kernel/locking/rtmutex_api.c:552 btrfs_record_root_in_trans+0x14f/0x180 fs/btrfs/transaction.c:505 start_transaction+0x3a6/0x1650 fs/btrfs/transaction.c:782 btrfs_dirty_inode+0x9f/0x190 fs/btrfs/inode.c:6443 touch_atime+0x2f8/0x6b0 fs/inode.c:2271 file_accessed include/linux/fs.h:2263 [inline] filemap_read+0x105c/0x1240 mm/filemap.c:2877 __kernel_read+0x50d/0x9c0 fs/read_write.c:532 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+0x12cf/0x1800 security/integrity/ima/ima_crypto.c:568 ima_collect_measurement+0x491/0x930 security/integrity/ima/ima_api.c:295 process_measurement+0x12d9/0x1c90 security/integrity/ima/ima_main.c:407 ima_file_check+0xe1/0x130 security/integrity/ima/ima_main.c:667 security_file_post_open+0xb3/0x260 security/security.c:2653 do_open fs/namei.c:4679 [inline] path_openat+0x2e88/0x38a0 fs/namei.c:4836 do_file_open+0x23e/0x4a0 fs/namei.c:4865 do_sys_openat2+0x113/0x200 fs/open.c:1366 do_sys_open fs/open.c:1372 [inline] __do_sys_openat fs/open.c:1388 [inline] __se_sys_openat fs/open.c:1383 [inline] __x64_sys_openat+0x138/0x170 fs/open.c:1383 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #3 (btrfs_trans_num_extwriters){++++}-{0:0}: join_transaction+0x1a4/0xc90 fs/btrfs/transaction.c:323 start_transaction+0x6b9/0x1650 fs/btrfs/transaction.c:708 btrfs_rebuild_free_space_tree+0xbb/0x6e0 fs/btrfs/free-space-tree.c:1335 btrfs_start_pre_rw_mount+0x1529/0x1f20 fs/btrfs/disk-io.c:3071 open_ctree+0x2e07/0x4220 fs/btrfs/disk-io.c:3668 btrfs_fill_super fs/btrfs/super.c:981 [inline] btrfs_get_tree_super fs/btrfs/super.c:1944 [inline] btrfs_get_tree_subvol fs/btrfs/super.c:2087 [inline] btrfs_get_tree+0x1061/0x1930 fs/btrfs/super.c:2121 vfs_get_tree+0x92/0x2a0 fs/super.c:1754 fc_mount fs/namespace.c:1193 [inline] do_new_mount_fc fs/namespace.c:3763 [inline] do_new_mount+0x341/0xd30 fs/namespace.c:3839 do_mount fs/namespace.c:4172 [inline] __do_sys_mount fs/namespace.c:4361 [inline] __se_sys_mount+0x31d/0x420 fs/namespace.c:4338 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #2 (btrfs_trans_num_writers){++++}-{0:0}: __lock_release kernel/locking/lockdep.c:5574 [inline] lock_release+0x199/0x3d0 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:1085 btrfs_dirty_inode+0x14c/0x190 fs/btrfs/inode.c:6457 touch_atime+0x2f8/0x6b0 fs/inode.c:2271 file_accessed include/linux/fs.h:2263 [inline] btrfs_file_mmap_prepare+0x189/0x200 fs/btrfs/file.c:2051 vfs_mmap_prepare include/linux/fs.h:2075 [inline] call_mmap_prepare mm/vma.c:2644 [inline] __mmap_region mm/vma.c:2743 [inline] mmap_region+0xdf2/0x2190 mm/vma.c:2844 do_mmap+0xc2f/0x10c0 mm/mmap.c:559 vm_mmap_pgoff+0x2cc/0x4f0 mm/util.c:581 ksys_mmap_pgoff+0x4e8/0x720 mm/mmap.c:605 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (&mm->mmap_lock){++++}-{4:4}: down_read_killable+0xa4/0x220 kernel/locking/rwsem.c:1560 mmap_read_lock_killable+0x1d/0x70 include/linux/mmap_lock.h:601 get_mmap_lock_carefully mm/mmap_lock.c:450 [inline] lock_mm_and_find_vma+0x2d7/0x340 mm/mmap_lock.c:501 do_user_addr_fault+0x330/0x1340 arch/x86/mm/fault.c:1357 handle_page_fault arch/x86/mm/fault.c:1474 [inline] exc_page_fault+0x6a/0xc0 arch/x86/mm/fault.c:1527 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:618 filldir+0x2b5/0x690 fs/readdir.c:295 dir_emit include/linux/fs.h:3566 [inline] offset_dir_emit fs/libfs.c:500 [inline] offset_iterate_dir fs/libfs.c:516 [inline] offset_readdir+0x3fc/0x530 fs/libfs.c:565 iterate_dir+0x3a5/0x580 fs/readdir.c:108 __do_sys_getdents fs/readdir.c:327 [inline] __se_sys_getdents+0xf1/0x270 fs/readdir.c:312 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x14d/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+0x15a5/0x2cf0 kernel/locking/lockdep.c:5237 lock_acquire+0xf0/0x2e0 kernel/locking/lockdep.c:5868 down_read+0x97/0x200 kernel/locking/rwsem.c:1537 inode_lock_shared include/linux/fs.h:1043 [inline] lookup_slow+0x46/0x70 fs/namei.c:1932 walk_component fs/namei.c:2279 [inline] lookup_last fs/namei.c:2786 [inline] path_lookupat+0x3f5/0x8c0 fs/namei.c:2810 filename_lookup+0x256/0x5d0 fs/namei.c:2839 kern_path+0x3d/0x150 fs/namei.c:3046 is_same_device fs/btrfs/volumes.c:763 [inline] device_list_add+0xfd1/0x2280 fs/btrfs/volumes.c:897 btrfs_scan_one_device+0x3ef/0x680 fs/btrfs/volumes.c:1498 btrfs_get_tree_super fs/btrfs/super.c:1858 [inline] btrfs_get_tree_subvol fs/btrfs/super.c:2087 [inline] btrfs_get_tree+0x4ab/0x1930 fs/btrfs/super.c:2121 vfs_get_tree+0x92/0x2a0 fs/super.c:1754 fc_mount fs/namespace.c:1193 [inline] do_new_mount_fc fs/namespace.c:3763 [inline] do_new_mount+0x341/0xd30 fs/namespace.c:3839 do_mount fs/namespace.c:4172 [inline] __do_sys_mount fs/namespace.c:4361 [inline] __se_sys_mount+0x31d/0x420 fs/namespace.c:4338 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x14d/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 --> &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.1.430/9208: #0: ffffffff8e3d9cb8 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree_super fs/btrfs/super.c:1852 [inline] #0: ffffffff8e3d9cb8 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree_subvol fs/btrfs/super.c:2087 [inline] #0: ffffffff8e3d9cb8 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree+0x47c/0x1930 fs/btrfs/super.c:2121 #1: ffff8880254df0c8 (&fs_devs->device_list_mutex){+.+.}-{4:4}, at: device_list_add+0x487/0x2280 fs/btrfs/volumes.c:842 stack backtrace: CPU: 1 UID: 0 PID: 9208 Comm: syz.1.430 Not tainted syzkaller #0 PREEMPT_{RT,(full)} Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/18/2026 Call Trace: dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 print_circular_bug+0x2e1/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+0x15a5/0x2cf0 kernel/locking/lockdep.c:5237 lock_acquire+0xf0/0x2e0 kernel/locking/lockdep.c:5868 down_read+0x97/0x200 kernel/locking/rwsem.c:1537 inode_lock_shared include/linux/fs.h:1043 [inline] lookup_slow+0x46/0x70 fs/namei.c:1932 walk_component fs/namei.c:2279 [inline] lookup_last fs/namei.c:2786 [inline] path_lookupat+0x3f5/0x8c0 fs/namei.c:2810 filename_lookup+0x256/0x5d0 fs/namei.c:2839 kern_path+0x3d/0x150 fs/namei.c:3046 is_same_device fs/btrfs/volumes.c:763 [inline] device_list_add+0xfd1/0x2280 fs/btrfs/volumes.c:897 btrfs_scan_one_device+0x3ef/0x680 fs/btrfs/volumes.c:1498 btrfs_get_tree_super fs/btrfs/super.c:1858 [inline] btrfs_get_tree_subvol fs/btrfs/super.c:2087 [inline] btrfs_get_tree+0x4ab/0x1930 fs/btrfs/super.c:2121 vfs_get_tree+0x92/0x2a0 fs/super.c:1754 fc_mount fs/namespace.c:1193 [inline] do_new_mount_fc fs/namespace.c:3763 [inline] do_new_mount+0x341/0xd30 fs/namespace.c:3839 do_mount fs/namespace.c:4172 [inline] __do_sys_mount fs/namespace.c:4361 [inline] __se_sys_mount+0x31d/0x420 fs/namespace.c:4338 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f8b9d43da8a Code: 48 c7 c2 e8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff c3 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 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f8b9b68de58 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007f8b9b68dee0 RCX: 00007f8b9d43da8a RDX: 0000200000000000 RSI: 00002000000015c0 RDI: 00007f8b9b68dea0 RBP: 0000200000000000 R08: 00007f8b9b68dee0 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00002000000015c0 R13: 00007f8b9b68dea0 R14: 000000000000559e R15: 0000200000000040 BTRFS info (device loop1): first mount of filesystem 395ef67a-297e-477c-816d-cd80a5b93e5d BTRFS info (device loop1): using sha256 checksum algorithm BTRFS info (device loop1): rebuilding free space tree BTRFS info (device loop1): enabling ssd optimizations BTRFS info (device loop1): using spread ssd allocation scheme BTRFS info (device loop1): turning on async discard BTRFS info (device loop1): enabling free space tree BTRFS info (device loop1): force clearing of disk cache