============================================ WARNING: possible recursive locking detected 6.16.0-syzkaller-11579-g35a813e010b9 #0 Not tainted -------------------------------------------- syz.0.0/5357 is trying to acquire lock: ffff888043bad078 (&sb->s_type->i_mutex_key#21){++++}-{4:4}, at: inode_lock include/linux/fs.h:869 [inline] ffff888043bad078 (&sb->s_type->i_mutex_key#21){++++}-{4:4}, at: bch2_symlink+0xf2/0x240 fs/bcachefs/fs.c:881 but task is already holding lock: ffff888043bac148 (&sb->s_type->i_mutex_key#21){++++}-{4:4}, at: inode_lock include/linux/fs.h:869 [inline] ffff888043bac148 (&sb->s_type->i_mutex_key#21){++++}-{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#21); lock(&sb->s_type->i_mutex_key#21); *** DEADLOCK *** May be due to missing lock nesting notation 6 locks held by syz.0.0/5357: #0: ffff8880432a8428 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:557 #1: ffff8880524ede50 (&ovl_i_mutex_dir_key[depth]/1){+.+.}-{4:4}, at: inode_lock_nested include/linux/fs.h:914 [inline] #1: ffff8880524ede50 (&ovl_i_mutex_dir_key[depth]/1){+.+.}-{4:4}, at: lock_rename fs/namei.c:3272 [inline] #1: ffff8880524ede50 (&ovl_i_mutex_dir_key[depth]/1){+.+.}-{4:4}, at: do_renameat2+0x3b9/0xa80 fs/namei.c:5224 #2: ffff8880524ee9e0 (&ovl_i_mutex_key[depth]/4){+.+.}-{4:4}, at: vfs_rename+0x6d8/0xf00 fs/namei.c:5100 #3: ffff8880524eed98 (&ovl_i_lock_key[depth]){+.+.}-{4:4}, at: ovl_inode_lock_interruptible fs/overlayfs/overlayfs.h:672 [inline] #3: ffff8880524eed98 (&ovl_i_lock_key[depth]){+.+.}-{4:4}, at: ovl_copy_up_start+0x56/0x330 fs/overlayfs/util.c:737 #4: ffff888041d82428 (sb_writers#12){.+.+}-{0:0}, at: ovl_copy_up_workdir fs/overlayfs/copy_up.c:781 [inline] #4: ffff888041d82428 (sb_writers#12){.+.+}-{0:0}, at: ovl_do_copy_up fs/overlayfs/copy_up.c:1001 [inline] #4: ffff888041d82428 (sb_writers#12){.+.+}-{0:0}, at: ovl_copy_up_one fs/overlayfs/copy_up.c:1202 [inline] #4: ffff888041d82428 (sb_writers#12){.+.+}-{0:0}, at: ovl_copy_up_flags+0x1090/0x2fe0 fs/overlayfs/copy_up.c:1257 #5: ffff888043bac148 (&sb->s_type->i_mutex_key#21){++++}-{4:4}, at: inode_lock include/linux/fs.h:869 [inline] #5: ffff888043bac148 (&sb->s_type->i_mutex_key#21){++++}-{4:4}, at: ovl_create_temp+0x54/0xb0 fs/overlayfs/dir.c:228 stack backtrace: CPU: 0 UID: 0 PID: 5357 Comm: syz.0.0 Not tainted 6.16.0-syzkaller-11579-g35a813e010b9 #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_rename+0x638/0x18b0 fs/overlayfs/dir.c:1137 vfs_rename+0xbda/0xf00 fs/namei.c:5129 do_renameat2+0x6ce/0xa80 fs/namei.c:5278 __do_sys_rename fs/namei.c:5325 [inline] __se_sys_rename fs/namei.c:5323 [inline] __x64_sys_rename+0x82/0x90 fs/namei.c:5323 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:0x7f64ae38eb69 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:00007f64af18c038 EFLAGS: 00000246 ORIG_RAX: 0000000000000052 RAX: ffffffffffffffda RBX: 00007f64ae5b6080 RCX: 00007f64ae38eb69 RDX: 0000000000000000 RSI: 0000200000000f40 RDI: 0000200000000600 RBP: 00007f64ae411df1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f64ae5b6080 R15: 00007fffa013d8c8