====================================================== WARNING: possible circular locking dependency detected 6.11.0-rc7-syzkaller-00039-g77f587896757 #0 Not tainted ------------------------------------------------------ syz.0.813/13049 is trying to acquire lock: ffff88805d450128 (&wnd->rw_lock/1){++++}-{3:3}, at: ntfs_mark_rec_free+0x3f/0x2b0 fs/ntfs3/fsntfs.c:742 but task is already holding lock: ffff88807fd23468 (&ni->ni_lock){+.+.}-{3:3}, at: ni_trylock fs/ntfs3/ntfs_fs.h:1130 [inline] ffff88807fd23468 (&ni->ni_lock){+.+.}-{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}: 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 vfs_create+0x23c/0x3d0 fs/namei.c:3280 do_mknodat+0x447/0x5b0 fs/namei.c:4138 __do_sys_mknod fs/namei.c:4171 [inline] __se_sys_mknod fs/namei.c:4169 [inline] __x64_sys_mknod+0x8c/0xa0 fs/namei.c:4169 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:2822 [inline] ntfs_file_write_iter+0x62b/0x740 fs/ntfs3/file.c:1199 do_iter_readv_writev+0x60a/0x890 vfs_writev+0x37c/0xbb0 fs/read_write.c:971 do_pwritev fs/read_write.c:1072 [inline] __do_sys_pwritev2 fs/read_write.c:1131 [inline] __se_sys_pwritev2+0x1ca/0x2d0 fs/read_write.c:1122 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); lock(&wnd->rw_lock/1); lock(&ni->ni_lock); lock(&wnd->rw_lock/1); *** DEADLOCK *** 3 locks held by syz.0.813/13049: #0: ffff8880684d6420 (sb_writers#14){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2882 [inline] #0: ffff8880684d6420 (sb_writers#14){.+.+}-{0:0}, at: vfs_writev+0x2d4/0xbb0 fs/read_write.c:969 #1: ffff88807fd23700 (&sb->s_type->i_mutex_key#27){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:800 [inline] #1: ffff88807fd23700 (&sb->s_type->i_mutex_key#27){+.+.}-{3:3}, at: __generic_file_fsync+0x9a/0x190 fs/libfs.c:1533 #2: ffff88807fd23468 (&ni->ni_lock){+.+.}-{3:3}, at: ni_trylock fs/ntfs3/ntfs_fs.h:1130 [inline] #2: ffff88807fd23468 (&ni->ni_lock){+.+.}-{3:3}, at: ni_write_inode+0x1bc/0x1010 fs/ntfs3/frecord.c:3333 stack backtrace: CPU: 1 UID: 0 PID: 13049 Comm: syz.0.813 Not tainted 6.11.0-rc7-syzkaller-00039-g77f587896757 #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:2822 [inline] ntfs_file_write_iter+0x62b/0x740 fs/ntfs3/file.c:1199 do_iter_readv_writev+0x60a/0x890 vfs_writev+0x37c/0xbb0 fs/read_write.c:971 do_pwritev fs/read_write.c:1072 [inline] __do_sys_pwritev2 fs/read_write.c:1131 [inline] __se_sys_pwritev2+0x1ca/0x2d0 fs/read_write.c:1122 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:0x7fdff417def9 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:00007fdff504b038 EFLAGS: 00000246 ORIG_RAX: 0000000000000148 RAX: ffffffffffffffda RBX: 00007fdff4335f80 RCX: 00007fdff417def9 RDX: 0000000000000001 RSI: 00000000200001c0 RDI: 0000000000000006 RBP: 00007fdff41f0b76 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000e7b R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fdff4335f80 R15: 00007ffc7965a0d8