====================================================== WARNING: possible circular locking dependency detected 6.9.0-rc4-next-20240418-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor423/5163 is trying to acquire lock: ffff888062b834a0 (&ni->ni_lock#2){+.+.}-{3:3}, at: ntfs_set_state+0x1ff/0x6c0 fs/ntfs3/fsntfs.c:947 but task is already holding lock: ffff888062ad5220 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1122 [inline] ffff888062ad5220 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_lookup+0xf9/0x1f0 fs/ntfs3/namei.c:84 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&ni->ni_lock/4){+.+.}-{3:3}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 ni_lock fs/ntfs3/ntfs_fs.h:1122 [inline] mi_read+0x2e1/0x5a0 fs/ntfs3/record.c:148 ntfs_read_mft fs/ntfs3/inode.c:70 [inline] ntfs_iget5+0x49a/0x3b10 fs/ntfs3/inode.c:539 ni_update_parent+0x943/0xdd0 fs/ntfs3/frecord.c:3218 ni_write_inode+0xde9/0x1010 fs/ntfs3/frecord.c:3324 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 write_inode_now+0x1d1/0x260 fs/fs-writeback.c:2822 ntfs_extend+0x39d/0x4a0 fs/ntfs3/file.c:358 ntfs_file_write_iter+0x3ea/0x770 fs/ntfs3/file.c:1124 new_sync_write fs/read_write.c:497 [inline] vfs_write+0xa72/0xc90 fs/read_write.c:590 ksys_write+0x1a0/0x2c0 fs/read_write.c:643 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&ni->ni_lock#2){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain+0x18cb/0x58e0 kernel/locking/lockdep.c:3869 __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754 __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_iget5+0x8db/0x3b10 fs/ntfs3/inode.c:546 dir_search_u+0x2fe/0x3a0 fs/ntfs3/dir.c:264 ntfs_lookup+0x106/0x1f0 fs/ntfs3/namei.c:85 lookup_open fs/namei.c:3483 [inline] open_last_lookups fs/namei.c:3574 [inline] path_openat+0x1033/0x3280 fs/namei.c:3804 do_filp_open+0x235/0x490 fs/namei.c:3834 do_sys_openat2+0x13e/0x1d0 fs/open.c:1405 do_sys_open fs/open.c:1420 [inline] __do_sys_openat fs/open.c:1436 [inline] __se_sys_openat fs/open.c:1431 [inline] __x64_sys_openat+0x247/0x2a0 fs/open.c:1431 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 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/4); lock(&ni->ni_lock#2); lock(&ni->ni_lock/4); lock(&ni->ni_lock#2); *** DEADLOCK *** 3 locks held by syz-executor423/5163: #0: ffff888073296420 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write+0x3f/0x90 fs/namespace.c:409 #1: ffff888062ad54c0 (&type->i_mutex_dir_key#8){++++}-{3:3}, at: inode_lock include/linux/fs.h:791 [inline] #1: ffff888062ad54c0 (&type->i_mutex_dir_key#8){++++}-{3:3}, at: open_last_lookups fs/namei.c:3571 [inline] #1: ffff888062ad54c0 (&type->i_mutex_dir_key#8){++++}-{3:3}, at: path_openat+0x7d3/0x3280 fs/namei.c:3804 #2: ffff888062ad5220 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1122 [inline] #2: ffff888062ad5220 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_lookup+0xf9/0x1f0 fs/ntfs3/namei.c:84 stack backtrace: CPU: 0 PID: 5163 Comm: syz-executor423 Not tainted 6.9.0-rc4-next-20240418-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2187 check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain+0x18cb/0x58e0 kernel/locking/lockdep.c:3869 __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754 __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_iget5+0x8db/0x3b10 fs/ntfs3/inode.c:546 dir_search_u+0x2fe/0x3a0 fs/ntfs3/dir.c:264 ntfs_lookup+0x106/0x1f0 fs/ntfs3/namei.c:85 lookup_open fs/namei.c:3483 [inline] open_last_lookups fs/namei.c:3574 [inline] path_openat+0x1033/0x3280 fs/namei.c:3804 do_filp_open+0x235/0x490 fs/namei.c:3834 do_sys_openat2+0x13e/0x1d0 fs/open.c:1405 do_sys_open fs/open.c:1420 [inline] __do_sys_openat fs/open.c:1436 [inline] __se_sys_openat fs/open.c:1431 [inline] __x64_sys_openat+0x247/0x2a0 fs/open.c:1431 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fc52acf8099 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 c1 1f 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:00007fc52ac7e168 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007fc52ad9e4b8 RCX: 00007fc52acf8099 RDX: 0000000000141842 RSI: 0000000020000100 RDI: 00000000ffffff9c RBP: 00007fc52ad9e4b0 R08: 00007ffe732757e7 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007fc52ad9e4bc R13: 000000000000006e R14: 00007ffe73275700 R15: 00007ffe732757e8 ntfs3: loop1: Mark volume as dirty due to NTFS errors