====================================================== WARNING: possible circular locking dependency detected 6.11.0-rc4-syzkaller-00255-gd2bafcf224f3 #0 Not tainted ------------------------------------------------------ syz.2.1572/21524 is trying to acquire lock: ffff88805f63a128 (&wnd->rw_lock/1){++++}-{3:3}, at: ntfs_mark_rec_free+0x3f/0x2b0 fs/ntfs3/fsntfs.c:742 but task is already holding lock: ffff88805b41a5b8 (&ni->ni_lock#3){+.+.}-{3:3}, at: ni_trylock fs/ntfs3/ntfs_fs.h:1130 [inline] ffff88805b41a5b8 (&ni->ni_lock#3){+.+.}-{3:3}, at: ni_write_inode+0x1bc/0x1010 fs/ntfs3/frecord.c:3333 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&ni->ni_lock#3){+.+.}-{3:3}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 ntfs_set_state+0x1ff/0x6c0 fs/ntfs3/fsntfs.c:947 ntfs_mark_rec_free+0x166/0x2b0 fs/ntfs3/fsntfs.c:748 ntfs_create_inode+0xcce/0x3880 fs/ntfs3/inode.c:1732 ntfs_create+0x3d/0x50 fs/ntfs3/namei.c:110 lookup_open fs/namei.c:3578 [inline] open_last_lookups fs/namei.c:3647 [inline] path_openat+0x1a9a/0x3470 fs/namei.c:3883 do_filp_open+0x235/0x490 fs/namei.c:3913 do_sys_openat2+0x13e/0x1d0 fs/open.c:1416 do_sys_open fs/open.c:1431 [inline] __do_sys_openat fs/open.c:1447 [inline] __se_sys_openat fs/open.c:1442 [inline] __x64_sys_openat+0x247/0x2a0 fs/open.c:1442 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&wnd->rw_lock/1){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3133 [inline] check_prevs_add kernel/locking/lockdep.c:3252 [inline] validate_chain+0x18e0/0x5900 kernel/locking/lockdep.c:3868 __lock_acquire+0x137a/0x2040 kernel/locking/lockdep.c:5142 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759 down_write_nested+0xa2/0x220 kernel/locking/rwsem.c:1695 ntfs_mark_rec_free+0x3f/0x2b0 fs/ntfs3/fsntfs.c:742 ni_write_inode+0xb8a/0x1010 fs/ntfs3/frecord.c:3433 write_inode fs/fs-writeback.c:1497 [inline] __writeback_single_inode+0x6b9/0x10b0 fs/fs-writeback.c:1716 writeback_single_inode+0x21b/0x7a0 fs/fs-writeback.c:1772 sync_inode_metadata+0xca/0x130 fs/fs-writeback.c:2842 __generic_file_fsync+0x13f/0x190 fs/libfs.c:1540 generic_file_fsync+0x73/0xf0 fs/libfs.c:1570 generic_write_sync include/linux/fs.h:2821 [inline] ntfs_file_write_iter+0x62b/0x740 fs/ntfs3/file.c:1199 new_sync_write fs/read_write.c:497 [inline] vfs_write+0xa72/0xc90 fs/read_write.c:590 ksys_pwrite64 fs/read_write.c:705 [inline] __do_sys_pwrite64 fs/read_write.c:715 [inline] __se_sys_pwrite64 fs/read_write.c:712 [inline] __x64_sys_pwrite64+0x1aa/0x230 fs/read_write.c:712 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&ni->ni_lock#3); lock(&wnd->rw_lock/1); lock(&ni->ni_lock#3); lock(&wnd->rw_lock/1); *** DEADLOCK *** 3 locks held by syz.2.1572/21524: #0: ffff88807a37c420 (sb_writers#22){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2881 [inline] #0: ffff88807a37c420 (sb_writers#22){.+.+}-{0:0}, at: vfs_write+0x227/0xc90 fs/read_write.c:586 #1: ffff88805b41a850 (&sb->s_type->i_mutex_key#30){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:799 [inline] #1: ffff88805b41a850 (&sb->s_type->i_mutex_key#30){+.+.}-{3:3}, at: __generic_file_fsync+0x9a/0x190 fs/libfs.c:1533 #2: ffff88805b41a5b8 (&ni->ni_lock#3){+.+.}-{3:3}, at: ni_trylock fs/ntfs3/ntfs_fs.h:1130 [inline] #2: ffff88805b41a5b8 (&ni->ni_lock#3){+.+.}-{3:3}, at: ni_write_inode+0x1bc/0x1010 fs/ntfs3/frecord.c:3333 stack backtrace: CPU: 1 UID: 0 PID: 21524 Comm: syz.2.1572 Not tainted 6.11.0-rc4-syzkaller-00255-gd2bafcf224f3 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Call Trace: __dump_stack lib/dump_stack.c:93 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2186 check_prev_add kernel/locking/lockdep.c:3133 [inline] check_prevs_add kernel/locking/lockdep.c:3252 [inline] validate_chain+0x18e0/0x5900 kernel/locking/lockdep.c:3868 __lock_acquire+0x137a/0x2040 kernel/locking/lockdep.c:5142 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759 down_write_nested+0xa2/0x220 kernel/locking/rwsem.c:1695 ntfs_mark_rec_free+0x3f/0x2b0 fs/ntfs3/fsntfs.c:742 ni_write_inode+0xb8a/0x1010 fs/ntfs3/frecord.c:3433 write_inode fs/fs-writeback.c:1497 [inline] __writeback_single_inode+0x6b9/0x10b0 fs/fs-writeback.c:1716 writeback_single_inode+0x21b/0x7a0 fs/fs-writeback.c:1772 sync_inode_metadata+0xca/0x130 fs/fs-writeback.c:2842 __generic_file_fsync+0x13f/0x190 fs/libfs.c:1540 generic_file_fsync+0x73/0xf0 fs/libfs.c:1570 generic_write_sync include/linux/fs.h:2821 [inline] ntfs_file_write_iter+0x62b/0x740 fs/ntfs3/file.c:1199 new_sync_write fs/read_write.c:497 [inline] vfs_write+0xa72/0xc90 fs/read_write.c:590 ksys_pwrite64 fs/read_write.c:705 [inline] __do_sys_pwrite64 fs/read_write.c:715 [inline] __se_sys_pwrite64 fs/read_write.c:712 [inline] __x64_sys_pwrite64+0x1aa/0x230 fs/read_write.c:712 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fc305779e79 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:00007fc3065b8038 EFLAGS: 00000246 ORIG_RAX: 0000000000000012 RAX: ffffffffffffffda RBX: 00007fc305915f80 RCX: 00007fc305779e79 RDX: 000000000000fdef RSI: 0000000020000140 RDI: 0000000000000006 RBP: 00007fc3057e793e R08: 0000000000000000 R09: 0000000000000000 R10: 000000000000fecc R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fc305915f80 R15: 00007ffcca55d058