BTRFS info (device loop2): enabling ssd optimizations ====================================================== WARNING: possible circular locking dependency detected 6.2.0-rc8-syzkaller-00027-g033c40a89f55 #0 Not tainted ------------------------------------------------------ syz-executor.2/5581 is trying to acquire lock: ffff88807de9de08 (btrfs-tree-01){++++}-{3:3}, at: __btrfs_tree_read_lock+0x31/0x370 fs/btrfs/locking.c:135 but task is already holding lock: ffff88801d4302e8 (btrfs-tree-00){++++}-{3:3}, at: __btrfs_tree_read_lock+0x31/0x370 fs/btrfs/locking.c:135 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (btrfs-tree-00){++++}-{3:3}: lock_acquire+0x235/0x630 kernel/locking/lockdep.c:5668 down_read_nested+0x40/0x60 kernel/locking/rwsem.c:1634 __btrfs_tree_read_lock+0x31/0x370 fs/btrfs/locking.c:135 btrfs_search_slot+0x16ba/0x2f70 fs/btrfs/ctree.c:2249 btrfs_init_root_free_objectid+0x148/0x320 fs/btrfs/disk-io.c:5373 btrfs_init_fs_root fs/btrfs/disk-io.c:1561 [inline] btrfs_get_root_ref+0x5ce/0xba0 fs/btrfs/disk-io.c:1765 btrfs_get_fs_root fs/btrfs/disk-io.c:1817 [inline] open_ctree+0x2879/0x2ec0 fs/btrfs/disk-io.c:3886 btrfs_fill_super+0x1c7/0x2d0 fs/btrfs/super.c:1151 btrfs_mount_root+0x874/0x990 fs/btrfs/super.c:1520 legacy_get_tree+0xef/0x190 fs/fs_context.c:610 vfs_get_tree+0x8c/0x270 fs/super.c:1489 fc_mount fs/namespace.c:1149 [inline] vfs_kern_mount+0xbc/0x150 fs/namespace.c:1179 btrfs_mount+0x39f/0xb50 fs/btrfs/super.c:1580 legacy_get_tree+0xef/0x190 fs/fs_context.c:610 vfs_get_tree+0x8c/0x270 fs/super.c:1489 do_new_mount+0x28f/0xae0 fs/namespace.c:3145 do_mount fs/namespace.c:3488 [inline] __do_sys_mount fs/namespace.c:3697 [inline] __se_sys_mount+0x2d9/0x3c0 fs/namespace.c:3674 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #0 (btrfs-tree-01){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3097 [inline] check_prevs_add kernel/locking/lockdep.c:3216 [inline] validate_chain+0x166b/0x58e0 kernel/locking/lockdep.c:3831 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5055 lock_acquire+0x235/0x630 kernel/locking/lockdep.c:5668 down_read_nested+0x40/0x60 kernel/locking/rwsem.c:1634 __btrfs_tree_read_lock+0x31/0x370 fs/btrfs/locking.c:135 btrfs_tree_read_lock fs/btrfs/locking.c:141 [inline] btrfs_read_lock_root_node+0x292/0x3c0 fs/btrfs/locking.c:280 btrfs_search_slot_get_root fs/btrfs/ctree.c:1779 [inline] btrfs_search_slot+0x571/0x2f70 fs/btrfs/ctree.c:2101 btrfs_lookup_inode+0xdc/0x480 fs/btrfs/inode-item.c:412 btrfs_read_locked_inode fs/btrfs/inode.c:3983 [inline] btrfs_iget_path+0x2d9/0x1520 fs/btrfs/inode.c:5799 btrfs_search_path_in_tree_user fs/btrfs/ioctl.c:1960 [inline] btrfs_ioctl_ino_lookup_user+0x75c/0xf30 fs/btrfs/ioctl.c:2104 btrfs_ioctl+0xb08/0xd40 fs/btrfs/ioctl.c:4668 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0xf1/0x160 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(btrfs-tree-00); lock(btrfs-tree-01); lock(btrfs-tree-00); lock(btrfs-tree-01); *** DEADLOCK *** 1 lock held by syz-executor.2/5581: #0: ffff88801d4302e8 (btrfs-tree-00){++++}-{3:3}, at: __btrfs_tree_read_lock+0x31/0x370 fs/btrfs/locking.c:135 stack backtrace: CPU: 0 PID: 5581 Comm: syz-executor.2 Not tainted 6.2.0-rc8-syzkaller-00027-g033c40a89f55 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 check_noncircular+0x2fe/0x3b0 kernel/locking/lockdep.c:2177 check_prev_add kernel/locking/lockdep.c:3097 [inline] check_prevs_add kernel/locking/lockdep.c:3216 [inline] validate_chain+0x166b/0x58e0 kernel/locking/lockdep.c:3831 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5055 lock_acquire+0x235/0x630 kernel/locking/lockdep.c:5668 down_read_nested+0x40/0x60 kernel/locking/rwsem.c:1634 __btrfs_tree_read_lock+0x31/0x370 fs/btrfs/locking.c:135 btrfs_tree_read_lock fs/btrfs/locking.c:141 [inline] btrfs_read_lock_root_node+0x292/0x3c0 fs/btrfs/locking.c:280 btrfs_search_slot_get_root fs/btrfs/ctree.c:1779 [inline] btrfs_search_slot+0x571/0x2f70 fs/btrfs/ctree.c:2101 btrfs_lookup_inode+0xdc/0x480 fs/btrfs/inode-item.c:412 btrfs_read_locked_inode fs/btrfs/inode.c:3983 [inline] btrfs_iget_path+0x2d9/0x1520 fs/btrfs/inode.c:5799 btrfs_search_path_in_tree_user fs/btrfs/ioctl.c:1960 [inline] btrfs_ioctl_ino_lookup_user+0x75c/0xf30 fs/btrfs/ioctl.c:2104 btrfs_ioctl+0xb08/0xd40 fs/btrfs/ioctl.c:4668 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0xf1/0x160 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f9e7e08c0f9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f9e7edcd168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f9e7e1abf80 RCX: 00007f9e7e08c0f9 RDX: 00000000200000c0 RSI: 00000000d000943e RDI: 0000000000000004 RBP: 00007f9e7e0e7ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fff5e12ce6f R14: 00007f9e7edcd300 R15: 0000000000022000