loop2: detected capacity change from 0 to 4096 ntfs3: loop2: Different NTFS' sector size (1024) and media sector size (512) ntfs3: loop2: ino=0, attr_set_size ====================================================== WARNING: possible circular locking dependency detected 6.1.115-syzkaller #0 Not tainted ------------------------------------------------------ syz.2.303/5965 is trying to acquire lock: ffff888070b10100 (&ni->ni_lock){+.+.}-{3:3}, at: ntfs_set_state+0x1fa/0x660 fs/ntfs3/fsntfs.c:920 but task is already holding lock: ffff888070b11f30 (&ni->file.run_lock#2){++++}-{3:3}, at: ntfs_extend_mft+0x15c/0x4a0 fs/ntfs3/fsntfs.c:482 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&ni->file.run_lock#2){++++}-{3:3}: lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662 down_read+0xad/0xa30 kernel/locking/rwsem.c:1520 mi_read+0x17d/0x5a0 fs/ntfs3/record.c:129 mi_format_new+0x1a7/0x5c0 fs/ntfs3/record.c:415 ni_add_subrecord+0xde/0x430 fs/ntfs3/frecord.c:371 ntfs_look_free_mft+0x874/0x10c0 fs/ntfs3/fsntfs.c:686 ni_create_attr_list+0x9b6/0x1470 fs/ntfs3/frecord.c:873 ni_ins_attr_ext+0x330/0xbf0 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+0x619/0xc30 fs/ntfs3/frecord.c:3103 ni_rename+0xbe/0x1e0 fs/ntfs3/frecord.c:3143 ntfs_rename+0x74a/0xd10 fs/ntfs3/namei.c:318 vfs_rename+0xd32/0x10f0 fs/namei.c:4874 do_renameat2+0xde0/0x1440 fs/namei.c:5027 __do_sys_renameat2 fs/namei.c:5060 [inline] __se_sys_renameat2 fs/namei.c:5057 [inline] __x64_sys_renameat2+0xce/0xe0 fs/namei.c:5057 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 -> #1 (&wnd->rw_lock/1){+.+.}-{3:3}: lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662 down_write_nested+0x39/0x60 kernel/locking/rwsem.c:1689 ntfs_mark_rec_free+0x3b/0x2b0 fs/ntfs3/fsntfs.c:713 ni_write_inode+0x506/0x1070 fs/ntfs3/frecord.c:3413 write_inode fs/fs-writeback.c:1460 [inline] __writeback_single_inode+0x67d/0x11e0 fs/fs-writeback.c:1677 writeback_sb_inodes+0xc2b/0x1b20 fs/fs-writeback.c:1903 wb_writeback+0x49d/0xe10 fs/fs-writeback.c:2077 wb_do_writeback fs/fs-writeback.c:2220 [inline] wb_workfn+0x427/0x1020 fs/fs-writeback.c:2260 process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292 worker_thread+0xa47/0x1200 kernel/workqueue.c:2439 kthread+0x28d/0x320 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 -> #0 (&ni->ni_lock){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3090 [inline] check_prevs_add kernel/locking/lockdep.c:3209 [inline] validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747 ntfs_set_state+0x1fa/0x660 fs/ntfs3/fsntfs.c:920 attr_set_size+0x330d/0x4310 fs/ntfs3/attrib.c:884 ntfs_extend_mft+0x2f2/0x4a0 fs/ntfs3/fsntfs.c:498 ntfs_look_free_mft+0x778/0x10c0 fs/ntfs3/fsntfs.c:680 ni_create_attr_list+0x9b6/0x1470 fs/ntfs3/frecord.c:873 ni_ins_attr_ext+0x330/0xbf0 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+0x619/0xc30 fs/ntfs3/frecord.c:3103 ni_rename+0xbe/0x1e0 fs/ntfs3/frecord.c:3143 ntfs_rename+0x74a/0xd10 fs/ntfs3/namei.c:318 vfs_rename+0xd32/0x10f0 fs/namei.c:4874 do_renameat2+0xde0/0x1440 fs/namei.c:5027 __do_sys_renameat2 fs/namei.c:5060 [inline] __se_sys_renameat2 fs/namei.c:5057 [inline] __x64_sys_renameat2+0xce/0xe0 fs/namei.c:5057 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 other info that might help us debug this: Chain exists of: &ni->ni_lock --> &wnd->rw_lock/1 --> &ni->file.run_lock#2 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&ni->file.run_lock#2); lock(&wnd->rw_lock/1); lock(&ni->file.run_lock#2); lock(&ni->ni_lock); *** DEADLOCK *** 7 locks held by syz.2.303/5965: #0: ffff8880576b0460 (sb_writers#19){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:393 #1: ffff888070b14600 (&type->i_mutex_dir_key#11/1){+.+.}-{3:3}, at: do_renameat2+0x65a/0x1440 fs/namei.c:4966 #2: ffff888070b154c0 (&sb->s_type->i_mutex_key#26/4){+.+.}-{3:3}, at: vfs_rename+0x7e4/0x10f0 fs/namei.c:4845 #3: ffff888070b14360 (&ni->ni_lock/5){+.+.}-{3:3}, at: ni_lock_dir fs/ntfs3/ntfs_fs.h:1106 [inline] #3: ffff888070b14360 (&ni->ni_lock/5){+.+.}-{3:3}, at: ntfs_rename+0x6fa/0xd10 fs/ntfs3/namei.c:314 #4: ffff888070b15220 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1101 [inline] #4: ffff888070b15220 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_rename+0x710/0xd10 fs/ntfs3/namei.c:315 #5: ffff888074ee6120 (&wnd->rw_lock/1){+.+.}-{3:3}, at: ntfs_look_free_mft+0x1e1/0x10c0 fs/ntfs3/fsntfs.c:542 #6: ffff888070b11f30 (&ni->file.run_lock#2){++++}-{3:3}, at: ntfs_extend_mft+0x15c/0x4a0 fs/ntfs3/fsntfs.c:482 stack backtrace: CPU: 1 PID: 5965 Comm: syz.2.303 Not tainted 6.1.115-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2170 check_prev_add kernel/locking/lockdep.c:3090 [inline] check_prevs_add kernel/locking/lockdep.c:3209 [inline] validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747 ntfs_set_state+0x1fa/0x660 fs/ntfs3/fsntfs.c:920 attr_set_size+0x330d/0x4310 fs/ntfs3/attrib.c:884 ntfs_extend_mft+0x2f2/0x4a0 fs/ntfs3/fsntfs.c:498 ntfs_look_free_mft+0x778/0x10c0 fs/ntfs3/fsntfs.c:680 ni_create_attr_list+0x9b6/0x1470 fs/ntfs3/frecord.c:873 ni_ins_attr_ext+0x330/0xbf0 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+0x619/0xc30 fs/ntfs3/frecord.c:3103 ni_rename+0xbe/0x1e0 fs/ntfs3/frecord.c:3143 ntfs_rename+0x74a/0xd10 fs/ntfs3/namei.c:318 vfs_rename+0xd32/0x10f0 fs/namei.c:4874 do_renameat2+0xde0/0x1440 fs/namei.c:5027 __do_sys_renameat2 fs/namei.c:5060 [inline] __se_sys_renameat2 fs/namei.c:5057 [inline] __x64_sys_renameat2+0xce/0xe0 fs/namei.c:5057 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7f359c37e719 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:00007f359d0b3038 EFLAGS: 00000246 ORIG_RAX: 000000000000013c RAX: ffffffffffffffda RBX: 00007f359c535f80 RCX: 00007f359c37e719 RDX: 0000000000000005 RSI: 0000000020000080 RDI: ffffffffffffff9c RBP: 00007f359c3f132e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000020000980 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f359c535f80 R15: 00007ffe67233c58 ntfs3: loop2: Mark volume as dirty due to NTFS errors