BTRFS: device fsid a6a605fc-d5f1-4e66-8595-3726e2b761d6 devid 1 transid 8 /dev/loop3 scanned by syz-executor.3 (8204) BTRFS info (device loop3): using blake2b (blake2b-256-generic) checksum algorithm BTRFS info (device loop3): turning on sync discard BTRFS info (device loop3): using free space tree BTRFS info (device loop3): enabling ssd optimizations ====================================================== WARNING: possible circular locking dependency detected 6.4.0-rc1-syzkaller-00071-g105131df9c3b #0 Not tainted ------------------------------------------------------ syz-executor.3/8204 is trying to acquire lock: ffff88802b9546c8 (btrfs-tree-01){++++}-{3:3}, at: __btrfs_tree_read_lock+0x31/0x200 fs/btrfs/locking.c:135 but task is already holding lock: ffff888016f688b8 (btrfs-tree-00){++++}-{3:3}, at: __btrfs_tree_read_lock+0x31/0x200 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}: down_read_nested+0x43/0x60 kernel/locking/rwsem.c:1645 __btrfs_tree_read_lock+0x31/0x200 fs/btrfs/locking.c:135 btrfs_search_slot+0x13ba/0x2da0 fs/btrfs/ctree.c:2252 btrfs_init_root_free_objectid+0xc6/0x290 fs/btrfs/disk-io.c:5193 btrfs_init_fs_root fs/btrfs/disk-io.c:1369 [inline] btrfs_get_root_ref.part.0+0x5ef/0xa10 fs/btrfs/disk-io.c:1573 btrfs_get_root_ref fs/btrfs/disk-io.c:1547 [inline] btrfs_get_fs_root fs/btrfs/disk-io.c:1625 [inline] open_ctree+0x2c18/0x55f0 fs/btrfs/disk-io.c:3711 btrfs_fill_super fs/btrfs/super.c:1157 [inline] btrfs_mount_root+0xa0c/0xd50 fs/btrfs/super.c:1525 legacy_get_tree+0x109/0x220 fs/fs_context.c:610 vfs_get_tree+0x8d/0x350 fs/super.c:1510 fc_mount fs/namespace.c:1035 [inline] vfs_kern_mount.part.0+0xd3/0x170 fs/namespace.c:1065 vfs_kern_mount+0x40/0x60 fs/namespace.c:1052 btrfs_mount+0x23f/0xb20 fs/btrfs/super.c:1585 legacy_get_tree+0x109/0x220 fs/fs_context.c:610 vfs_get_tree+0x8d/0x350 fs/super.c:1510 do_new_mount fs/namespace.c:3039 [inline] path_mount+0x134b/0x1e40 fs/namespace.c:3369 do_mount fs/namespace.c:3382 [inline] __do_sys_mount fs/namespace.c:3591 [inline] __se_sys_mount fs/namespace.c:3568 [inline] __x64_sys_mount+0x283/0x300 fs/namespace.c:3568 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 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:3108 [inline] check_prevs_add kernel/locking/lockdep.c:3227 [inline] validate_chain kernel/locking/lockdep.c:3842 [inline] __lock_acquire+0x2f21/0x5df0 kernel/locking/lockdep.c:5074 lock_acquire kernel/locking/lockdep.c:5691 [inline] lock_acquire+0x1b1/0x520 kernel/locking/lockdep.c:5656 down_read_nested+0x43/0x60 kernel/locking/rwsem.c:1645 __btrfs_tree_read_lock+0x31/0x200 fs/btrfs/locking.c:135 btrfs_tree_read_lock fs/btrfs/locking.c:141 [inline] btrfs_read_lock_root_node+0x7c/0x250 fs/btrfs/locking.c:280 btrfs_search_slot_get_root fs/btrfs/ctree.c:1782 [inline] btrfs_search_slot+0x3e0/0x2da0 fs/btrfs/ctree.c:2104 btrfs_lookup_inode+0xba/0x3e0 fs/btrfs/inode-item.c:412 btrfs_read_locked_inode+0xcd5/0x15f0 fs/btrfs/inode.c:3768 btrfs_iget_path fs/btrfs/inode.c:5584 [inline] btrfs_iget+0x192/0x220 fs/btrfs/inode.c:5606 btrfs_search_path_in_tree_user+0x473/0x9a0 fs/btrfs/ioctl.c:1962 btrfs_ioctl_ino_lookup_user fs/btrfs/ioctl.c:2106 [inline] btrfs_ioctl+0x6ea/0x5b30 fs/btrfs/ioctl.c:4678 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x197/0x210 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 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 ---- ---- rlock(btrfs-tree-00); lock(btrfs-tree-01); lock(btrfs-tree-00); rlock(btrfs-tree-01); *** DEADLOCK *** 1 lock held by syz-executor.3/8204: #0: ffff888016f688b8 (btrfs-tree-00){++++}-{3:3}, at: __btrfs_tree_read_lock+0x31/0x200 fs/btrfs/locking.c:135 stack backtrace: CPU: 1 PID: 8204 Comm: syz-executor.3 Not tainted 6.4.0-rc1-syzkaller-00071-g105131df9c3b #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2188 check_prev_add kernel/locking/lockdep.c:3108 [inline] check_prevs_add kernel/locking/lockdep.c:3227 [inline] validate_chain kernel/locking/lockdep.c:3842 [inline] __lock_acquire+0x2f21/0x5df0 kernel/locking/lockdep.c:5074 lock_acquire kernel/locking/lockdep.c:5691 [inline] lock_acquire+0x1b1/0x520 kernel/locking/lockdep.c:5656 down_read_nested+0x43/0x60 kernel/locking/rwsem.c:1645 __btrfs_tree_read_lock+0x31/0x200 fs/btrfs/locking.c:135 btrfs_tree_read_lock fs/btrfs/locking.c:141 [inline] btrfs_read_lock_root_node+0x7c/0x250 fs/btrfs/locking.c:280 btrfs_search_slot_get_root fs/btrfs/ctree.c:1782 [inline] btrfs_search_slot+0x3e0/0x2da0 fs/btrfs/ctree.c:2104 btrfs_lookup_inode+0xba/0x3e0 fs/btrfs/inode-item.c:412 btrfs_read_locked_inode+0xcd5/0x15f0 fs/btrfs/inode.c:3768 btrfs_iget_path fs/btrfs/inode.c:5584 [inline] btrfs_iget+0x192/0x220 fs/btrfs/inode.c:5606 btrfs_search_path_in_tree_user+0x473/0x9a0 fs/btrfs/ioctl.c:1962 btrfs_ioctl_ino_lookup_user fs/btrfs/ioctl.c:2106 [inline] btrfs_ioctl+0x6ea/0x5b30 fs/btrfs/ioctl.c:4678 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x197/0x210 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f262c48c169 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:00007f262d16f168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f262c5abf80 RCX: 00007f262c48c169 RDX: 00000000200001c0 RSI: 00000000d000943e RDI: 0000000000000004 RBP: 00007f262c4e7ca1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe298873ef R14: 00007f262d16f300 R15: 0000000000022000