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.191/5242 is trying to acquire lock: ffff0000f28a34a0 (&ni->ni_lock){+.+.}-{3:3}, at: ntfs_set_state+0x1a4/0x584 fs/ntfs3/fsntfs.c:920 but task is already holding lock: ffff0000f28a6190 (&ni->file.run_lock#2){++++}-{3:3}, at: ntfs_extend_mft+0x120/0x3ec 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}: down_read+0x64/0x308 kernel/locking/rwsem.c:1520 mi_read+0x150/0x4d8 fs/ntfs3/record.c:129 mi_format_new+0x174/0x514 fs/ntfs3/record.c:415 ni_add_subrecord+0xd0/0x3c4 fs/ntfs3/frecord.c:371 ntfs_look_free_mft+0x4c8/0xd1c fs/ntfs3/fsntfs.c:686 ni_create_attr_list+0x764/0xf54 fs/ntfs3/frecord.c:873 ni_ins_attr_ext+0x300/0xa10 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+0x4d8/0xa0c fs/ntfs3/frecord.c:3103 ni_rename+0xc8/0x1d8 fs/ntfs3/frecord.c:3143 ntfs_rename+0x5c4/0xaf8 fs/ntfs3/namei.c:318 vfs_rename+0xac8/0xe04 fs/namei.c:4874 do_renameat2+0x9ec/0xe64 fs/namei.c:5027 __do_sys_renameat2 fs/namei.c:5060 [inline] __se_sys_renameat2 fs/namei.c:5057 [inline] __arm64_sys_renameat2+0xe0/0xfc fs/namei.c:5057 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:204 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585 -> #1 (&wnd->rw_lock/1){+.+.}-{3:3}: down_write_nested+0x64/0x94 kernel/locking/rwsem.c:1689 ntfs_mark_rec_free+0x48/0x270 fs/ntfs3/fsntfs.c:713 ni_write_inode+0xb04/0xe3c fs/ntfs3/frecord.c:3413 ntfs3_write_inode+0x70/0x98 fs/ntfs3/inode.c:1031 write_inode fs/fs-writeback.c:1460 [inline] __writeback_single_inode+0x614/0x1770 fs/fs-writeback.c:1677 writeback_sb_inodes+0x978/0x1718 fs/fs-writeback.c:1903 wb_writeback+0x414/0x1130 fs/fs-writeback.c:2077 wb_do_writeback fs/fs-writeback.c:2220 [inline] wb_workfn+0x3a8/0x1034 fs/fs-writeback.c:2260 process_one_work+0x7ac/0x1404 kernel/workqueue.c:2292 worker_thread+0x8e4/0xfec kernel/workqueue.c:2439 kthread+0x250/0x2d8 kernel/kthread.c:376 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864 -> #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 kernel/locking/lockdep.c:3825 [inline] __lock_acquire+0x3338/0x7680 kernel/locking/lockdep.c:5049 lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5662 __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799 ntfs_set_state+0x1a4/0x584 fs/ntfs3/fsntfs.c:920 ntfs_bad_inode+0x88/0x9c fs/ntfs3/fsntfs.c:885 attr_set_size+0x280c/0x346c fs/ntfs3/attrib.c:884 ntfs_extend_mft+0x260/0x3ec fs/ntfs3/fsntfs.c:498 ntfs_look_free_mft+0x5fc/0xd1c fs/ntfs3/fsntfs.c:680 ni_create_attr_list+0x764/0xf54 fs/ntfs3/frecord.c:873 ni_ins_attr_ext+0x300/0xa10 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+0x4d8/0xa0c fs/ntfs3/frecord.c:3103 ni_rename+0xc8/0x1d8 fs/ntfs3/frecord.c:3143 ntfs_rename+0x5c4/0xaf8 fs/ntfs3/namei.c:318 vfs_rename+0xac8/0xe04 fs/namei.c:4874 do_renameat2+0x9ec/0xe64 fs/namei.c:5027 __do_sys_renameat2 fs/namei.c:5060 [inline] __se_sys_renameat2 fs/namei.c:5057 [inline] __arm64_sys_renameat2+0xe0/0xfc fs/namei.c:5057 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:204 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585 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.191/5242: #0: ffff0000f6ab8460 (sb_writers#12){.+.+}-{0:0}, at: mnt_want_write+0x44/0x9c fs/namespace.c:393 #1: ffff0000f28a1260 (&type->i_mutex_dir_key#9/1){+.+.}-{3:3}, at: do_renameat2+0x538/0xe64 fs/namei.c:4966 #2: ffff0000f28a19c0 (&sb->s_type->i_mutex_key#20/4){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:793 [inline] #2: ffff0000f28a19c0 (&sb->s_type->i_mutex_key#20/4){+.+.}-{3:3}, at: lock_two_nondirectories+0xc4/0x120 fs/inode.c:1206 #3: ffff0000f28a0fc0 (&ni->ni_lock/5){+.+.}-{3:3}, at: ni_lock_dir fs/ntfs3/ntfs_fs.h:1106 [inline] #3: ffff0000f28a0fc0 (&ni->ni_lock/5){+.+.}-{3:3}, at: ntfs_rename+0x58c/0xaf8 fs/ntfs3/namei.c:314 #4: ffff0000f28a1720 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1101 [inline] #4: ffff0000f28a1720 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_rename+0x59c/0xaf8 fs/ntfs3/namei.c:315 #5: ffff0000f6ace120 (&wnd->rw_lock/1){+.+.}-{3:3}, at: ntfs_look_free_mft+0x190/0xd1c fs/ntfs3/fsntfs.c:542 #6: ffff0000f28a6190 (&ni->file.run_lock#2){++++}-{3:3}, at: ntfs_extend_mft+0x120/0x3ec fs/ntfs3/fsntfs.c:482 stack backtrace: CPU: 0 PID: 5242 Comm: syz.2.191 Not tainted 6.1.115-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call trace: dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106 dump_stack+0x1c/0x58 lib/dump_stack.c:113 print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2048 check_noncircular+0x2cc/0x378 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 kernel/locking/lockdep.c:3825 [inline] __lock_acquire+0x3338/0x7680 kernel/locking/lockdep.c:5049 lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5662 __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799 ntfs_set_state+0x1a4/0x584 fs/ntfs3/fsntfs.c:920 ntfs_bad_inode+0x88/0x9c fs/ntfs3/fsntfs.c:885 attr_set_size+0x280c/0x346c fs/ntfs3/attrib.c:884 ntfs_extend_mft+0x260/0x3ec fs/ntfs3/fsntfs.c:498 ntfs_look_free_mft+0x5fc/0xd1c fs/ntfs3/fsntfs.c:680 ni_create_attr_list+0x764/0xf54 fs/ntfs3/frecord.c:873 ni_ins_attr_ext+0x300/0xa10 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+0x4d8/0xa0c fs/ntfs3/frecord.c:3103 ni_rename+0xc8/0x1d8 fs/ntfs3/frecord.c:3143 ntfs_rename+0x5c4/0xaf8 fs/ntfs3/namei.c:318 vfs_rename+0xac8/0xe04 fs/namei.c:4874 do_renameat2+0x9ec/0xe64 fs/namei.c:5027 __do_sys_renameat2 fs/namei.c:5060 [inline] __se_sys_renameat2 fs/namei.c:5057 [inline] __arm64_sys_renameat2+0xe0/0xfc fs/namei.c:5057 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:204 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585 ntfs3: loop2: Mark volume as dirty due to NTFS errors