====================================================== WARNING: possible circular locking dependency detected 6.11.0-syzkaller #0 Not tainted ------------------------------------------------------ kworker/u8:8/2979 is trying to acquire lock: ffff8880206ea128 (&wnd->rw_lock /1){+.+.}-{3:3}, at: ntfs_mark_rec_free+0x3f/0x2b0 fs/ntfs3/fsntfs.c:742 but task is already holding lock: ffff88807af22d10 (&ni->ni_lock#2){+.+.}-{3:3}, at: ni_trylock fs/ntfs3/ntfs_fs.h:1130 [inline] ffff88807af22d10 (&ni->ni_lock#2){+.+.}-{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#2){+.+.}-{3:3}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759 __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+0x4d1/0x3bb0 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:1469 exportfs_decode_fh_raw+0x166/0x6a0 fs/exportfs/expfs.c:444 do_handle_to_path fs/fhandle.c:209 [inline] handle_to_path fs/fhandle.c:310 [inline] do_handle_open+0x764/0x9a0 fs/fhandle.c:328 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:5759 down_read+0xb1/0xa40 kernel/locking/rwsem.c:1526 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:1768 ntfs_link+0x116/0x270 fs/ntfs3/namei.c:146 vfs_link+0x4f5/0x690 fs/namei.c:4692 do_linkat+0x555/0x6f0 fs/namei.c:4762 __do_sys_link fs/namei.c:4796 [inline] __se_sys_link fs/namei.c:4794 [inline] __x64_sys_link+0x82/0x90 fs/namei.c:4794 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:3133 [inline] check_prevs_add kernel/locking/lockdep.c:3252 [inline] validate_chain+0x18e0/0x5900 kernel/locking/lockdep.c:3868 __lock_acquire+0x137a/0x2040 kernel/locking/lockdep.c:5142 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759 down_write_nested+0xa2/0x220 kernel/locking/rwsem.c:1695 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:1497 [inline] __writeback_single_inode+0x6b9/0x10b0 fs/fs-writeback.c:1716 writeback_sb_inodes+0x99c/0x1380 fs/fs-writeback.c:1947 wb_writeback+0x481/0xd40 fs/fs-writeback.c:2127 wb_do_writeback fs/fs-writeback.c:2274 [inline] wb_workfn+0x410/0x1090 fs/fs-writeback.c:2314 process_one_work kernel/workqueue.c:3231 [inline] process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312 worker_thread+0x870/0xd30 kernel/workqueue.c:3393 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 other info that might help us debug this: Chain exists of: &wnd->rw_lock/1 --> &ni->file.run_lock#2 --> &ni->ni_lock#2 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&ni->ni_lock#2); lock(&ni->file.run_lock#2); lock(&ni->ni_lock#2); lock(&wnd->rw_lock/1); *** DEADLOCK *** 3 locks held by kworker/u8:8/2979: #0: ffff8880206e2948 ((wq_completion)writeback){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3206 [inline] #0: ffff8880206e2948 ((wq_completion)writeback){+.+.}-{0:0}, at: process_scheduled_works+0x90a/0x1830 kernel/workqueue.c:3312 #1: ffffc90009a9fd00 ((work_completion)(&(&wb->dwork)->work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3207 [inline] #1: ffffc90009a9fd00 ((work_completion)(&(&wb->dwork)->work)){+.+.}-{0:0}, at: process_scheduled_works+0x945/0x1830 kernel/workqueue.c:3312 #2: ffff88807af22d10 (&ni->ni_lock#2){+.+.}-{3:3}, at: ni_trylock fs/ntfs3/ntfs_fs.h:1130 [inline] #2: ffff88807af22d10 (&ni->ni_lock#2){+.+.}-{3:3}, at: ni_write_inode+0x1bc/0x1010 fs/ntfs3/frecord.c:3333 stack backtrace: CPU: 1 UID: 0 PID: 2979 Comm: kworker/u8:8 Not tainted 6.11.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Workqueue: writeback wb_workfn (flush-7:0) Call Trace: __dump_stack lib/dump_stack.c:93 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2186 check_prev_add kernel/locking/lockdep.c:3133 [inline] check_prevs_add kernel/locking/lockdep.c:3252 [inline] validate_chain+0x18e0/0x5900 kernel/locking/lockdep.c:3868 __lock_acquire+0x137a/0x2040 kernel/locking/lockdep.c:5142 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759 down_write_nested+0xa2/0x220 kernel/locking/rwsem.c:1695 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:1497 [inline] __writeback_single_inode+0x6b9/0x10b0 fs/fs-writeback.c:1716 writeback_sb_inodes+0x99c/0x1380 fs/fs-writeback.c:1947 wb_writeback+0x481/0xd40 fs/fs-writeback.c:2127 wb_do_writeback fs/fs-writeback.c:2274 [inline] wb_workfn+0x410/0x1090 fs/fs-writeback.c:2314 process_one_work kernel/workqueue.c:3231 [inline] process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312 worker_thread+0x870/0xd30 kernel/workqueue.c:3393 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244