====================================================== WARNING: possible circular locking dependency detected 6.4.0-rc7-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.1/7050 is trying to acquire lock: ffff88807cfc5be0 (&delayed_node->mutex){+.+.}-{3:3}, at: __btrfs_release_delayed_node+0x9c/0x960 fs/btrfs/delayed-inode.c:256 but task is already holding lock: ffff88806b176c00 (btrfs-tree-00/1){+.+.}-{3:3}, at: __btrfs_tree_lock+0x31/0x1b0 fs/btrfs/locking.c:198 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (btrfs-tree-00/1){+.+.}-{3:3}: reacquire_held_locks+0x3aa/0x660 kernel/locking/lockdep.c:5230 __lock_release kernel/locking/lockdep.c:5419 [inline] lock_release+0x36f/0x9d0 kernel/locking/lockdep.c:5725 up_write+0x79/0x580 kernel/locking/rwsem.c:1625 btrfs_tree_unlock_rw fs/btrfs/locking.h:189 [inline] btrfs_unlock_up_safe+0x11c/0x2d0 fs/btrfs/locking.c:239 search_leaf fs/btrfs/ctree.c:1986 [inline] btrfs_search_slot+0x1e6b/0x26d0 fs/btrfs/ctree.c:2230 btrfs_insert_empty_items+0x94/0x130 fs/btrfs/ctree.c:4376 btrfs_insert_delayed_item fs/btrfs/delayed-inode.c:746 [inline] btrfs_insert_delayed_items fs/btrfs/delayed-inode.c:824 [inline] __btrfs_commit_inode_delayed_items+0xc60/0x2080 fs/btrfs/delayed-inode.c:1111 __btrfs_run_delayed_items+0x17f/0x310 fs/btrfs/delayed-inode.c:1153 btrfs_commit_transaction+0xc04/0x2a90 fs/btrfs/transaction.c:2377 create_snapshot+0x40f/0x6d0 fs/btrfs/ioctl.c:845 btrfs_mksubvol+0x4ec/0x650 fs/btrfs/ioctl.c:995 btrfs_mksnapshot+0x98/0xd0 fs/btrfs/ioctl.c:1041 __btrfs_ioctl_snap_create+0x27b/0x360 fs/btrfs/ioctl.c:1294 btrfs_ioctl_snap_create+0x10f/0x160 fs/btrfs/ioctl.c:1321 btrfs_ioctl+0xa8b/0xb60 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0xa7/0xf0 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 -> #0 (&delayed_node->mutex){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3113 [inline] check_prevs_add kernel/locking/lockdep.c:3232 [inline] validate_chain+0x166b/0x58f0 kernel/locking/lockdep.c:3847 __lock_acquire+0x1316/0x2070 kernel/locking/lockdep.c:5088 lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5705 __mutex_lock_common+0x1d8/0x2530 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:799 __btrfs_release_delayed_node+0x9c/0x960 fs/btrfs/delayed-inode.c:256 btrfs_release_delayed_node fs/btrfs/delayed-inode.c:281 [inline] __btrfs_run_delayed_items+0x218/0x310 fs/btrfs/delayed-inode.c:1156 btrfs_commit_transaction+0xc04/0x2a90 fs/btrfs/transaction.c:2377 create_snapshot+0x40f/0x6d0 fs/btrfs/ioctl.c:845 btrfs_mksubvol+0x4ec/0x650 fs/btrfs/ioctl.c:995 btrfs_mksnapshot+0x98/0xd0 fs/btrfs/ioctl.c:1041 __btrfs_ioctl_snap_create+0x27b/0x360 fs/btrfs/ioctl.c:1294 btrfs_ioctl_snap_create+0x10f/0x160 fs/btrfs/ioctl.c:1321 btrfs_ioctl+0xa8b/0xb60 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0xa7/0xf0 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/1); lock(&delayed_node->mutex); lock(btrfs-tree-00/1); lock(&delayed_node->mutex); *** DEADLOCK *** 9 locks held by syz-executor.1/7050: #0: ffff888063fb4448 (sb_writers#14){.+.+}-{0:0}, at: mnt_want_write_file+0x5b/0x1a0 fs/namespace.c:438 #1: ffff88806c86eb50 (&type->i_mutex_dir_key#8/1){+.+.}-{3:3}, at: btrfs_mksubvol+0x1c7/0x650 fs/btrfs/ioctl.c:967 #2: ffff88802091cbe0 (&fs_info->subvol_sem){++++}-{3:3}, at: btrfs_mksubvol+0x469/0x650 fs/btrfs/ioctl.c:989 #3: ffff888063fb4638 (sb_internal#2){.+.+}-{0:0}, at: create_snapshot+0x3b3/0x6d0 fs/btrfs/ioctl.c:837 #4: ffff88802091e438 (btrfs_trans_completed){++++}-{0:0}, at: btrfs_commit_transaction+0xb02/0x2a90 fs/btrfs/transaction.c:2335 #5: ffff88802091e410 (btrfs_trans_super_committed){.+.+}-{0:0}, at: btrfs_commit_transaction+0xb42/0x2a90 fs/btrfs/transaction.c:2336 #6: ffff88802091e3e8 (btrfs_trans_unblocked){++++}-{0:0}, at: btrfs_commit_transaction+0xb75/0x2a90 fs/btrfs/transaction.c:2337 #7: ffff88802091ccb0 (&fs_info->reloc_mutex){+.+.}-{3:3}, at: btrfs_commit_transaction+0xbec/0x2a90 fs/btrfs/transaction.c:2356 #8: ffff88806b176c00 (btrfs-tree-00/1){+.+.}-{3:3}, at: __btrfs_tree_lock+0x31/0x1b0 fs/btrfs/locking.c:198 stack backtrace: CPU: 1 PID: 7050 Comm: syz-executor.1 Not tainted 6.4.0-rc7-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/09/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x167/0x220 lib/dump_stack.c:106 check_noncircular+0x2fe/0x3b0 kernel/locking/lockdep.c:2188 check_prev_add kernel/locking/lockdep.c:3113 [inline] check_prevs_add kernel/locking/lockdep.c:3232 [inline] validate_chain+0x166b/0x58f0 kernel/locking/lockdep.c:3847 __lock_acquire+0x1316/0x2070 kernel/locking/lockdep.c:5088 lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5705 __mutex_lock_common+0x1d8/0x2530 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:799 __btrfs_release_delayed_node+0x9c/0x960 fs/btrfs/delayed-inode.c:256 btrfs_release_delayed_node fs/btrfs/delayed-inode.c:281 [inline] __btrfs_run_delayed_items+0x218/0x310 fs/btrfs/delayed-inode.c:1156 btrfs_commit_transaction+0xc04/0x2a90 fs/btrfs/transaction.c:2377 create_snapshot+0x40f/0x6d0 fs/btrfs/ioctl.c:845 btrfs_mksubvol+0x4ec/0x650 fs/btrfs/ioctl.c:995 btrfs_mksnapshot+0x98/0xd0 fs/btrfs/ioctl.c:1041 __btrfs_ioctl_snap_create+0x27b/0x360 fs/btrfs/ioctl.c:1294 btrfs_ioctl_snap_create+0x10f/0x160 fs/btrfs/ioctl.c:1321 btrfs_ioctl+0xa8b/0xb60 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0xa7/0xf0 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:0x7f2bed47cae9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f2bee2650c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f2bed59c120 RCX: 00007f2bed47cae9 RDX: 0000000020002180 RSI: 0000000050009401 RDI: 0000000000000008 RBP: 00007f2bed4c847a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f2bed59c120 R15: 00007fff4d7d74b8 ------------[ cut here ]------------ BTRFS: Transaction aborted (error -17) WARNING: CPU: 1 PID: 7050 at fs/btrfs/delayed-inode.c:1158 __btrfs_run_delayed_items+0x2d4/0x310 fs/btrfs/delayed-inode.c:1158 Modules linked in: CPU: 1 PID: 7050 Comm: syz-executor.1 Not tainted 6.4.0-rc7-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/09/2023 RIP: 0010:__btrfs_run_delayed_items+0x2d4/0x310 fs/btrfs/delayed-inode.c:1158 Code: 89 d9 80 e1 07 fe c1 38 c1 0f 8c a0 fd ff ff 48 89 df e8 7f 81 af fe e9 93 fd ff ff 48 c7 c7 20 88 65 88 89 ee e8 6c 41 36 fe <0f> 0b eb 92 f3 0f 1e fa 48 b8 00 00 00 00 00 fc ff df 41 80 3c 07 RSP: 0018:ffffc900093978f8 EFLAGS: 00010246 RAX: a56575f168482e00 RBX: ffff88802091c000 RCX: 0000000000000002 RDX: 0000000000000001 RSI: 0000000000000008 RDI: 0000000000000001 RBP: 00000000ffffffef R08: dffffc0000000000 R09: fffff52001272e9d R10: 0000000000000000 R11: dffffc0000000001 R12: ffff88807cfc5b20 R13: 00000000ffffffff R14: ffff888074f7bc78 R15: 1ffff1100e9ef799 FS: 00007f2bee2656c0(0000) GS:ffff8880ba100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020004000 CR3: 000000002254c000 CR4: 00000000003506e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: btrfs_commit_transaction+0xc04/0x2a90 fs/btrfs/transaction.c:2377 create_snapshot+0x40f/0x6d0 fs/btrfs/ioctl.c:845 btrfs_mksubvol+0x4ec/0x650 fs/btrfs/ioctl.c:995 btrfs_mksnapshot+0x98/0xd0 fs/btrfs/ioctl.c:1041 __btrfs_ioctl_snap_create+0x27b/0x360 fs/btrfs/ioctl.c:1294 btrfs_ioctl_snap_create+0x10f/0x160 fs/btrfs/ioctl.c:1321 btrfs_ioctl+0xa8b/0xb60 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0xa7/0xf0 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:0x7f2bed47cae9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f2bee2650c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f2bed59c120 RCX: 00007f2bed47cae9 RDX: 0000000020002180 RSI: 0000000050009401 RDI: 0000000000000008 RBP: 00007f2bed4c847a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f2bed59c120 R15: 00007fff4d7d74b8