loop0: detected capacity change from 0 to 32768 bcachefs (loop0): starting version 1.7: mi_btree_bitmap opts=errors=continue,metadata_checksum=none,data_checksum=none,compression=lz4,background_target=invalid device 79,nojournal_transaction_names allowing incompatible features above 0.0: (unknown version) features: lz4,new_siphash,inline_data,new_extent_overwrite,btree_ptr_v2,new_varint,journal_no_flush,alloc_v2,extents_across_btree_nodes bcachefs (loop0): Using encoding defined by superblock: utf8-12.1.0 bcachefs (loop0): initializing new filesystem bcachefs (loop0): going read-write bcachefs (loop0): marking superblocks bcachefs (loop0): initializing freespace bcachefs (loop0): done initializing freespace bcachefs (loop0): reading snapshots table bcachefs (loop0): reading snapshots done bcachefs (loop0): done starting filesystem ============================================ WARNING: possible recursive locking detected 6.17.0-rc1-syzkaller-00150-g8d084337a32f #0 Not tainted -------------------------------------------- syz.0.0/5353 is trying to acquire lock: ffff888044671810 (&sb->s_type->i_mutex_key#20){++++}-{4:4}, at: inode_lock include/linux/fs.h:869 [inline] ffff888044671810 (&sb->s_type->i_mutex_key#20){++++}-{4:4}, at: bch2_symlink+0xf2/0x240 fs/bcachefs/fs.c:881 but task is already holding lock: ffff8880446708e0 (&sb->s_type->i_mutex_key#20){++++}-{4:4}, at: inode_lock include/linux/fs.h:869 [inline] ffff8880446708e0 (&sb->s_type->i_mutex_key#20){++++}-{4:4}, at: ovl_create_temp+0x54/0xb0 fs/overlayfs/dir.c:228 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&sb->s_type->i_mutex_key#20); lock(&sb->s_type->i_mutex_key#20); *** DEADLOCK *** May be due to missing lock nesting notation 6 locks held by syz.0.0/5353: #0: ffff88803e71e428 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:557 #1: ffff888044629e50 (&ovl_i_mutex_dir_key[depth]/1){+.+.}-{4:4}, at: inode_lock_nested include/linux/fs.h:914 [inline] #1: ffff888044629e50 (&ovl_i_mutex_dir_key[depth]/1){+.+.}-{4:4}, at: do_unlinkat+0x1c7/0x560 fs/namei.c:4637 #2: ffff88804462a418 (&ovl_i_mutex_key[depth]){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:869 [inline] #2: ffff88804462a418 (&ovl_i_mutex_key[depth]){+.+.}-{4:4}, at: vfs_unlink+0xf2/0x650 fs/namei.c:4575 #3: ffff88804462a7d0 (&ovl_i_lock_key[depth]){+.+.}-{4:4}, at: ovl_inode_lock_interruptible fs/overlayfs/overlayfs.h:672 [inline] #3: ffff88804462a7d0 (&ovl_i_lock_key[depth]){+.+.}-{4:4}, at: ovl_copy_up_start+0x56/0x330 fs/overlayfs/util.c:737 #4: ffff888033170428 (sb_writers#12){.+.+}-{0:0}, at: ovl_copy_up_workdir fs/overlayfs/copy_up.c:781 [inline] #4: ffff888033170428 (sb_writers#12){.+.+}-{0:0}, at: ovl_do_copy_up fs/overlayfs/copy_up.c:1001 [inline] #4: ffff888033170428 (sb_writers#12){.+.+}-{0:0}, at: ovl_copy_up_one fs/overlayfs/copy_up.c:1202 [inline] #4: ffff888033170428 (sb_writers#12){.+.+}-{0:0}, at: ovl_copy_up_flags+0x1090/0x2fe0 fs/overlayfs/copy_up.c:1257 #5: ffff8880446708e0 (&sb->s_type->i_mutex_key#20){++++}-{4:4}, at: inode_lock include/linux/fs.h:869 [inline] #5: ffff8880446708e0 (&sb->s_type->i_mutex_key#20){++++}-{4:4}, at: ovl_create_temp+0x54/0xb0 fs/overlayfs/dir.c:228 stack backtrace: CPU: 0 UID: 0 PID: 5353 Comm: syz.0.0 Not tainted 6.17.0-rc1-syzkaller-00150-g8d084337a32f #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_deadlock_bug+0x28b/0x2a0 kernel/locking/lockdep.c:3041 check_deadlock kernel/locking/lockdep.c:3093 [inline] validate_chain+0x1a3f/0x2140 kernel/locking/lockdep.c:3895 __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5237 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868 down_write+0x96/0x1f0 kernel/locking/rwsem.c:1590 inode_lock include/linux/fs.h:869 [inline] bch2_symlink+0xf2/0x240 fs/bcachefs/fs.c:881 vfs_symlink+0x140/0x2f0 fs/namei.c:4730 ovl_do_symlink+0x89/0xd0 fs/overlayfs/overlayfs.h:270 ovl_create_real+0x245/0x410 fs/overlayfs/dir.c:201 ovl_create_temp+0x70/0xb0 fs/overlayfs/dir.c:229 ovl_copy_up_workdir fs/overlayfs/copy_up.c:782 [inline] ovl_do_copy_up fs/overlayfs/copy_up.c:1001 [inline] ovl_copy_up_one fs/overlayfs/copy_up.c:1202 [inline] ovl_copy_up_flags+0x10aa/0x2fe0 fs/overlayfs/copy_up.c:1257 ovl_nlink_start+0x9a/0x3e0 fs/overlayfs/util.c:1171 ovl_do_remove+0x24e/0xda0 fs/overlayfs/dir.c:907 vfs_unlink+0x394/0x650 fs/namei.c:4586 do_unlinkat+0x345/0x560 fs/namei.c:4650 __do_sys_unlink fs/namei.c:4696 [inline] __se_sys_unlink fs/namei.c:4694 [inline] __x64_sys_unlink+0x47/0x50 fs/namei.c:4694 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f0dae78ebe9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f0daf5fc038 EFLAGS: 00000246 ORIG_RAX: 0000000000000057 RAX: ffffffffffffffda RBX: 00007f0dae9b5fa0 RCX: 00007f0dae78ebe9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000200000000440 RBP: 00007f0dae811e19 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f0dae9b6038 R14: 00007f0dae9b5fa0 R15: 00007ffda5a6a898 syz.0.0 (5353) used greatest stack depth: 16984 bytes left