loop1: detected capacity change from 0 to 4096 ====================================================== WARNING: possible circular locking dependency detected 6.12.0-rc2-syzkaller #0 Not tainted ------------------------------------------------------ syz.1.428/9140 is trying to acquire lock: ffff88806add0128 (&wnd->rw_lock/1){++++}-{3:3}, at: ntfs_mark_rec_free+0x3f/0x2b0 fs/ntfs3/fsntfs.c:742 but task is already holding lock: ffff88805c3a5920 (&ni->ni_lock#3){+.+.}-{3:3}, at: ni_trylock fs/ntfs3/ntfs_fs.h:1129 [inline] ffff88805c3a5920 (&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: -> #2 (&ni->ni_lock#3){+.+.}-{3:3}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825 __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 ni_find_attr+0x6eb/0x8d0 fs/ntfs3/frecord.c:240 attr_load_runs_vcn+0xd5/0x360 fs/ntfs3/attrib.c:1316 mi_read+0x346/0x5a0 fs/ntfs3/record.c:151 ntfs_read_mft fs/ntfs3/inode.c:70 [inline] ntfs_iget5+0x482/0x3940 fs/ntfs3/inode.c:537 ntfs_export_get_inode+0xdc/0x190 fs/ntfs3/super.c:797 generic_fh_to_dentry+0x9f/0xf0 fs/libfs.c:1468 exportfs_decode_fh_raw+0x166/0x6a0 fs/exportfs/expfs.c:444 do_handle_to_path fs/fhandle.c:224 [inline] handle_to_path fs/fhandle.c:325 [inline] do_handle_open+0x764/0x9a0 fs/fhandle.c:343 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 -> #1 (&ni->file.run_lock#2){++++}-{3:3}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825 down_read+0xb1/0xa40 kernel/locking/rwsem.c:1524 mi_read+0x181/0x5a0 fs/ntfs3/record.c:129 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:3115 ntfs_link_inode+0x130/0x170 fs/ntfs3/inode.c:1727 ntfs_link+0x116/0x270 fs/ntfs3/namei.c:146 vfs_link+0x4f0/0x6e0 fs/namei.c:4739 do_linkat+0x555/0x6f0 fs/namei.c:4809 __do_sys_link fs/namei.c:4843 [inline] __se_sys_link fs/namei.c:4841 [inline] __x64_sys_link+0x82/0x90 fs/namei.c:4841 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:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904 __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5202 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825 down_write_nested+0xa2/0x220 kernel/locking/rwsem.c:1693 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:1503 [inline] __writeback_single_inode+0x711/0x10d0 fs/fs-writeback.c:1723 writeback_single_inode+0x1f3/0x660 fs/fs-writeback.c:1779 sync_inode_metadata+0xc4/0x120 fs/fs-writeback.c:2849 __generic_file_fsync+0x134/0x1a0 fs/libfs.c:1539 generic_file_fsync+0x70/0xf0 fs/libfs.c:1569 generic_write_sync include/linux/fs.h:2871 [inline] ntfs_file_write_iter+0x627/0x740 fs/ntfs3/file.c:1198 new_sync_write fs/read_write.c:590 [inline] vfs_write+0xa6d/0xc90 fs/read_write.c:683 ksys_pwrite64 fs/read_write.c:798 [inline] __do_sys_pwrite64 fs/read_write.c:808 [inline] __se_sys_pwrite64 fs/read_write.c:805 [inline] __x64_sys_pwrite64+0x1aa/0x230 fs/read_write.c:805 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: Chain exists of: &wnd->rw_lock/1 --> &ni->file.run_lock#2 --> &ni->ni_lock#3 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&ni->ni_lock#3); lock(&ni->file.run_lock#2); lock(&ni->ni_lock#3); lock(&wnd->rw_lock/1); *** DEADLOCK *** 3 locks held by syz.1.428/9140: #0: ffff88806add4420 (sb_writers#20){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2931 [inline] #0: ffff88806add4420 (sb_writers#20){.+.+}-{0:0}, at: vfs_write+0x224/0xc90 fs/read_write.c:679 #1: ffff88805c3a5bb8 (&sb->s_type->i_mutex_key#28){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:815 [inline] #1: ffff88805c3a5bb8 (&sb->s_type->i_mutex_key#28){+.+.}-{3:3}, at: __generic_file_fsync+0x97/0x1a0 fs/libfs.c:1532 #2: ffff88805c3a5920 (&ni->ni_lock#3){+.+.}-{3:3}, at: ni_trylock fs/ntfs3/ntfs_fs.h:1129 [inline] #2: ffff88805c3a5920 (&ni->ni_lock#3){+.+.}-{3:3}, at: ni_write_inode+0x1bc/0x1010 fs/ntfs3/frecord.c:3333 stack backtrace: CPU: 0 UID: 0 PID: 9140 Comm: syz.1.428 Not tainted 6.12.0-rc2-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_circular_bug+0x13a/0x1b0 kernel/locking/lockdep.c:2074 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2206 check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904 __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5202 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825 down_write_nested+0xa2/0x220 kernel/locking/rwsem.c:1693 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:1503 [inline] __writeback_single_inode+0x711/0x10d0 fs/fs-writeback.c:1723 writeback_single_inode+0x1f3/0x660 fs/fs-writeback.c:1779 sync_inode_metadata+0xc4/0x120 fs/fs-writeback.c:2849 __generic_file_fsync+0x134/0x1a0 fs/libfs.c:1539 generic_file_fsync+0x70/0xf0 fs/libfs.c:1569 generic_write_sync include/linux/fs.h:2871 [inline] ntfs_file_write_iter+0x627/0x740 fs/ntfs3/file.c:1198 new_sync_write fs/read_write.c:590 [inline] vfs_write+0xa6d/0xc90 fs/read_write.c:683 ksys_pwrite64 fs/read_write.c:798 [inline] __do_sys_pwrite64 fs/read_write.c:808 [inline] __se_sys_pwrite64 fs/read_write.c:805 [inline] __x64_sys_pwrite64+0x1aa/0x230 fs/read_write.c:805 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:0x7fd3cb77dff9 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:00007fd3cc589038 EFLAGS: 00000246 ORIG_RAX: 0000000000000012 RAX: ffffffffffffffda RBX: 00007fd3cb935f80 RCX: 00007fd3cb77dff9 RDX: 000000000000fdef RSI: 0000000020000140 RDI: 0000000000000005 RBP: 00007fd3cb7f0296 R08: 0000000000000000 R09: 0000000000000000 R10: 000000000000fecc R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fd3cb935f80 R15: 00007ffd3167ef08