loop4: detected capacity change from 0 to 4096 ntfs3: loop4: Different NTFS' sector size (2048) and media sector size (512) ntfs3: loop4: ino=0, attr_set_size ====================================================== WARNING: possible circular locking dependency detected 6.1.57-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.4/15286 is trying to acquire lock: ffff88808e753c00 (&ni->ni_lock){+.+.}-{3:3}, at: ntfs_set_state+0x217/0x6f0 fs/ntfs3/fsntfs.c:920 but task is already holding lock: ffff88808e5b9f30 (&ni->file.run_lock#2){++++}-{3:3}, at: ntfs_extend_mft+0x15c/0x4b0 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:5661 down_write+0x36/0x60 kernel/locking/rwsem.c:1573 ntfs_extend_mft+0x15c/0x4b0 fs/ntfs3/fsntfs.c:482 ntfs_look_free_mft+0x439/0x10c0 fs/ntfs3/fsntfs.c:561 ntfs_create_inode+0x430/0x3760 fs/ntfs3/inode.c:1297 ntfs_create+0x3e/0x60 fs/ntfs3/namei.c:110 lookup_open fs/namei.c:3413 [inline] open_last_lookups fs/namei.c:3481 [inline] path_openat+0x12f1/0x2e60 fs/namei.c:3711 do_filp_open+0x230/0x480 fs/namei.c:3741 do_sys_openat2+0x13b/0x500 fs/open.c:1318 do_sys_open fs/open.c:1334 [inline] __do_sys_open fs/open.c:1342 [inline] __se_sys_open fs/open.c:1338 [inline] __x64_sys_open+0x221/0x270 fs/open.c:1338 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+0x63/0xcd -> #1 (&wnd->rw_lock/1){+.+.}-{3:3}: lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5661 down_write_nested+0x39/0x60 kernel/locking/rwsem.c:1689 ntfs_mark_rec_free+0x3b/0x2b0 fs/ntfs3/fsntfs.c:713 ni_write_inode+0x433/0x1240 fs/ntfs3/frecord.c:3338 write_inode fs/fs-writeback.c:1443 [inline] __writeback_single_inode+0x67d/0x11e0 fs/fs-writeback.c:1655 writeback_sb_inodes+0xc21/0x1ac0 fs/fs-writeback.c:1881 wb_writeback+0x49d/0xe10 fs/fs-writeback.c:2055 wb_do_writeback fs/fs-writeback.c:2198 [inline] wb_workfn+0x427/0x1020 fs/fs-writeback.c:2238 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:306 -> #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+0x1667/0x58e0 kernel/locking/lockdep.c:3824 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5048 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5661 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747 ntfs_set_state+0x217/0x6f0 fs/ntfs3/fsntfs.c:920 attr_set_size+0x32e5/0x42f0 fs/ntfs3/attrib.c:880 ntfs_extend_mft+0x2f6/0x4b0 fs/ntfs3/fsntfs.c:498 ntfs_look_free_mft+0x439/0x10c0 fs/ntfs3/fsntfs.c:561 ntfs_create_inode+0x430/0x3760 fs/ntfs3/inode.c:1297 ntfs_create+0x3e/0x60 fs/ntfs3/namei.c:110 lookup_open fs/namei.c:3413 [inline] open_last_lookups fs/namei.c:3481 [inline] path_openat+0x12f1/0x2e60 fs/namei.c:3711 do_filp_open+0x230/0x480 fs/namei.c:3741 do_sys_openat2+0x13b/0x500 fs/open.c:1318 do_sys_open fs/open.c:1334 [inline] __do_sys_openat fs/open.c:1350 [inline] __se_sys_openat fs/open.c:1345 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1345 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+0x63/0xcd 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 *** 5 locks held by syz-executor.4/15286: #0: ffff888021a98460 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:393 #1: ffff88808e5beae0 (&type->i_mutex_dir_key#8){++++}-{3:3}, at: inode_lock include/linux/fs.h:756 [inline] #1: ffff88808e5beae0 (&type->i_mutex_dir_key#8){++++}-{3:3}, at: open_last_lookups fs/namei.c:3478 [inline] #1: ffff88808e5beae0 (&type->i_mutex_dir_key#8){++++}-{3:3}, at: path_openat+0x7b6/0x2e60 fs/namei.c:3711 #2: ffff88808e5be840 (&ni->ni_lock/5){+.+.}-{3:3}, at: ni_lock_dir fs/ntfs3/ntfs_fs.h:1116 [inline] #2: ffff88808e5be840 (&ni->ni_lock/5){+.+.}-{3:3}, at: ntfs_create_inode+0x1ce/0x3760 fs/ntfs3/inode.c:1220 #3: ffff88807338c120 (&wnd->rw_lock/1){+.+.}-{3:3}, at: ntfs_look_free_mft+0x1e1/0x10c0 fs/ntfs3/fsntfs.c:542 #4: ffff88808e5b9f30 (&ni->file.run_lock#2){++++}-{3:3}, at: ntfs_extend_mft+0x15c/0x4b0 fs/ntfs3/fsntfs.c:482 stack backtrace: CPU: 0 PID: 15286 Comm: syz-executor.4 Not tainted 6.1.57-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023 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+0x1667/0x58e0 kernel/locking/lockdep.c:3824 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5048 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5661 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747 ntfs_set_state+0x217/0x6f0 fs/ntfs3/fsntfs.c:920 attr_set_size+0x32e5/0x42f0 fs/ntfs3/attrib.c:880 ntfs_extend_mft+0x2f6/0x4b0 fs/ntfs3/fsntfs.c:498 ntfs_look_free_mft+0x439/0x10c0 fs/ntfs3/fsntfs.c:561 ntfs_create_inode+0x430/0x3760 fs/ntfs3/inode.c:1297 ntfs_create+0x3e/0x60 fs/ntfs3/namei.c:110 lookup_open fs/namei.c:3413 [inline] open_last_lookups fs/namei.c:3481 [inline] path_openat+0x12f1/0x2e60 fs/namei.c:3711 do_filp_open+0x230/0x480 fs/namei.c:3741 do_sys_openat2+0x13b/0x500 fs/open.c:1318 do_sys_open fs/open.c:1334 [inline] __do_sys_openat fs/open.c:1350 [inline] __se_sys_openat fs/open.c:1345 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1345 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+0x63/0xcd RIP: 0033:0x7fdd21a7cae9 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:00007fdd228320c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007fdd21b9bf80 RCX: 00007fdd21a7cae9 RDX: 000000000000275a RSI: 0000000020000040 RDI: ffffffffffffff9c RBP: 00007fdd21ac847a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007fdd21b9bf80 R15: 00007fff5008a8a8 ntfs3: loop4: Mark volume as dirty due to NTFS errors