======================================================
WARNING: possible circular locking dependency detected
5.15.131-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor460/3662 is trying to acquire lock:
ffff8880701e3c00 (&ni->ni_lock){+.+.}-{3:3}, at: ntfs_set_state+0x217/0x6f0 fs/ntfs3/fsntfs.c:925
but task is already holding lock:
ffff888070232d40 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1110 [inline]
ffff888070232d40 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_lookup+0xf5/0x1f0 fs/ntfs3/namei.c:82
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+0x1db/0x4f0 kernel/locking/lockdep.c:5622
__mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
ni_lock fs/ntfs3/ntfs_fs.h:1110 [inline]
mi_read+0x2dd/0x5a0 fs/ntfs3/record.c:148
ntfs_read_mft fs/ntfs3/inode.c:69 [inline]
ntfs_iget5+0x483/0x3900 fs/ntfs3/inode.c:524
ni_update_parent+0x802/0xc80 fs/ntfs3/frecord.c:3148
ni_write_inode+0xe32/0x1070 fs/ntfs3/frecord.c:3246
write_inode fs/fs-writeback.c:1478 [inline]
__writeback_single_inode+0x644/0xe30 fs/fs-writeback.c:1683
writeback_single_inode+0x22c/0x960 fs/fs-writeback.c:1738
write_inode_now+0x26e/0x2f0 fs/fs-writeback.c:2778
ntfs_extend+0x3c2/0x4c0 fs/ntfs3/file.c:458
ntfs_file_write_iter+0x2eb/0x540 fs/ntfs3/file.c:1139
call_write_iter include/linux/fs.h:2103 [inline]
new_sync_write fs/read_write.c:507 [inline]
vfs_write+0xacf/0xe50 fs/read_write.c:594
ksys_write+0x1a2/0x2c0 fs/read_write.c:647
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb
-> #0 (&ni->ni_lock){+.+.}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain+0x1646/0x58b0 kernel/locking/lockdep.c:3787
__lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5011
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622
__mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
ntfs_set_state+0x217/0x6f0 fs/ntfs3/fsntfs.c:925
ntfs_iget5+0x57a/0x3900 fs/ntfs3/inode.c:531
dir_search_u+0x2f6/0x390 fs/ntfs3/dir.c:264
ntfs_lookup+0x102/0x1f0 fs/ntfs3/namei.c:83
lookup_open fs/namei.c:3370 [inline]
open_last_lookups fs/namei.c:3462 [inline]
path_openat+0x110e/0x2f20 fs/namei.c:3669
do_filp_open+0x21c/0x460 fs/namei.c:3699
do_sys_openat2+0x13b/0x500 fs/open.c:1211
do_sys_open fs/open.c:1227 [inline]
__do_sys_openat fs/open.c:1243 [inline]
__se_sys_openat fs/open.c:1238 [inline]
__x64_sys_openat+0x243/0x290 fs/open.c:1238
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&ni->ni_lock/4);
lock(&ni->ni_lock);
lock(&ni->ni_lock/4);
lock(&ni->ni_lock);
*** DEADLOCK ***
3 locks held by syz-executor460/3662:
#0: ffff888023acc460 (sb_writers#11){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:377
#1: ffff888070232fe0 (&type->i_mutex_dir_key#8){++++}-{3:3}, at: inode_lock include/linux/fs.h:787 [inline]
#1: ffff888070232fe0 (&type->i_mutex_dir_key#8){++++}-{3:3}, at: open_last_lookups fs/namei.c:3459 [inline]
#1: ffff888070232fe0 (&type->i_mutex_dir_key#8){++++}-{3:3}, at: path_openat+0x824/0x2f20 fs/namei.c:3669
#2: ffff888070232d40 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1110 [inline]
#2: ffff888070232d40 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_lookup+0xf5/0x1f0 fs/ntfs3/namei.c:82
stack backtrace:
CPU: 1 PID: 3662 Comm: syz-executor460 Not tainted 5.15.131-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
check_noncircular+0x2f8/0x3b0 kernel/locking/lockdep.c:2133
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain+0x1646/0x58b0 kernel/locking/lockdep.c:3787
__lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5011
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622
__mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
ntfs_set_state+0x217/0x6f0 fs/ntfs3/fsntfs.c:925
ntfs_iget5+0x57a/0x3900 fs/ntfs3/inode.c:531
dir_search_u+0x2f6/0x390 fs/ntfs3/dir.c:264
ntfs_lookup+0x102/0x1f0 fs/ntfs3/namei.c:83
lookup_open fs/namei.c:3370 [inline]
open_last_lookups fs/namei.c:3462 [inline]
path_openat+0x110e/0x2f20 fs/namei.c:3669
do_filp_open+0x21c/0x460 fs/namei.c:3699
do_sys_openat2+0x13b/0x500 fs/open.c:1211
do_sys_open fs/open.c:1227 [inline]
__do_sys_openat fs/open.c:1243 [inline]
__se_sys_openat fs/open.c:1238 [inline]
__x64_sys_openat+0x243/0x290 fs/open.c:1238
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f2098754919
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 a1 1a 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:00007f20904ec218 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f20987fb6f8 RCX: 00007f2098754919
RDX: 0000000000141842 RSI: 0000000020000100 RDI: 00000000ffffff9c
RBP: 00007f20987fb6f0 R08: 00007ffc8dc32267 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f20987fb6fc
R13: 0031656c69662f2e R14: 0030656c69662f2e R15: 00007f20987a8660
</TASK>
ntfs3: loop0: Mark volume as dirty due to NTFS errors