loop4: detected capacity change from 0 to 4096 ====================================================== WARNING: possible circular locking dependency detected 6.9.0-syzkaller-09880-gdaa121128a2d #0 Not tainted ------------------------------------------------------ syz-executor.4/19782 is trying to acquire lock: ffff8880620e6128 (&wnd->rw_lock/1){+.+.}-{3:3}, at: ntfs_mark_rec_free+0x3f/0x2b0 fs/ntfs3/fsntfs.c:742 but task is already holding lock: ffff888062a7f700 (&ni->ni_lock#2){+.+.}-{3:3}, at: ni_trylock fs/ntfs3/ntfs_fs.h:1143 [inline] ffff888062a7f700 (&ni->ni_lock#2){+.+.}-{3:3}, at: ni_write_inode+0x1bc/0x1010 fs/ntfs3/frecord.c:3265 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&ni->ni_lock#2){+.+.}-{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 ntfs_set_state+0x1ff/0x6c0 fs/ntfs3/fsntfs.c:947 mi_read+0x49e/0x5a0 fs/ntfs3/record.c:185 mi_format_new+0x1ab/0x5d0 fs/ntfs3/record.c:420 ni_add_subrecord+0xe2/0x430 fs/ntfs3/frecord.c:372 ntfs_look_free_mft+0x878/0x10c0 fs/ntfs3/fsntfs.c:715 ni_create_attr_list+0x9bd/0x1480 fs/ntfs3/frecord.c:876 ni_ins_attr_ext+0x369/0xbe0 fs/ntfs3/frecord.c:974 ni_insert_attr fs/ntfs3/frecord.c:1141 [inline] ni_insert_resident fs/ntfs3/frecord.c:1525 [inline] ni_add_name+0x809/0xe90 fs/ntfs3/frecord.c:3047 ni_rename+0xc2/0x1e0 fs/ntfs3/frecord.c:3087 ntfs_rename+0x7c1/0xd10 fs/ntfs3/namei.c:334 vfs_rename+0xbdb/0xf00 fs/namei.c:4887 do_renameat2+0xd94/0x13f0 fs/namei.c:5044 __do_sys_rename fs/namei.c:5091 [inline] __se_sys_rename fs/namei.c:5089 [inline] __x64_sys_rename+0x86/0xa0 fs/namei.c:5089 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 (&wnd->rw_lock/1){+.+.}-{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 down_write_nested+0x3d/0x50 kernel/locking/rwsem.c:1695 ntfs_mark_rec_free+0x3f/0x2b0 fs/ntfs3/fsntfs.c:742 ni_write_inode+0xbd9/0x1010 fs/ntfs3/frecord.c:3365 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:1115 call_write_iter include/linux/fs.h:2120 [inline] new_sync_write fs/read_write.c:497 [inline] vfs_write+0xa2d/0xc50 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 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&ni->ni_lock#2); lock(&wnd->rw_lock/1); lock(&ni->ni_lock#2); lock(&wnd->rw_lock/1); *** DEADLOCK *** 4 locks held by syz-executor.4/19782: #0: ffff88807b62afc8 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x259/0x320 fs/file.c:1191 #1: ffff88802aaa8420 (sb_writers#19){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2871 [inline] #1: ffff88802aaa8420 (sb_writers#19){.+.+}-{0:0}, at: vfs_write+0x227/0xc50 fs/read_write.c:586 #2: ffff888062a7f9a0 (&sb->s_type->i_mutex_key#28){+.+.}-{3:3}, at: inode_trylock include/linux/fs.h:811 [inline] #2: ffff888062a7f9a0 (&sb->s_type->i_mutex_key#28){+.+.}-{3:3}, at: ntfs_file_write_iter+0x25a/0x770 fs/ntfs3/file.c:1093 #3: ffff888062a7f700 (&ni->ni_lock#2){+.+.}-{3:3}, at: ni_trylock fs/ntfs3/ntfs_fs.h:1143 [inline] #3: ffff888062a7f700 (&ni->ni_lock#2){+.+.}-{3:3}, at: ni_write_inode+0x1bc/0x1010 fs/ntfs3/frecord.c:3265 stack backtrace: CPU: 0 PID: 19782 Comm: syz-executor.4 Not tainted 6.9.0-syzkaller-09880-gdaa121128a2d #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/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 down_write_nested+0x3d/0x50 kernel/locking/rwsem.c:1695 ntfs_mark_rec_free+0x3f/0x2b0 fs/ntfs3/fsntfs.c:742 ni_write_inode+0xbd9/0x1010 fs/ntfs3/frecord.c:3365 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:1115 call_write_iter include/linux/fs.h:2120 [inline] new_sync_write fs/read_write.c:497 [inline] vfs_write+0xa2d/0xc50 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 RIP: 0033:0x7f595327cee9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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:00007f5953f110c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f59533abf80 RCX: 00007f595327cee9 RDX: 00000000ffffff3e RSI: 0000000020000080 RDI: 0000000000000007 RBP: 00007f59532c949e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f59533abf80 R15: 00007ffe780a3848