====================================================== WARNING: possible circular locking dependency detected 6.1.22-syzkaller #0 Not tainted ------------------------------------------------------ kworker/u4:1/11 is trying to acquire lock: ffff00011caba120 (&wnd->rw_lock/1){+.+.}-{3:3}, at: ntfs_mark_rec_free+0x48/0x270 fs/ntfs3/fsntfs.c:713 but task is already holding lock: ffff00011e3d4ac0 (&ni->ni_lock){+.+.}-{3:3}, at: ni_trylock fs/ntfs3/ntfs_fs.h:1123 [inline] ffff00011e3d4ac0 (&ni->ni_lock){+.+.}-{3:3}, at: ni_write_inode+0x134/0xfb8 fs/ntfs3/frecord.c:3240 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&ni->ni_lock){+.+.}-{3:3}: __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/0x5c4 fs/ntfs3/fsntfs.c:920 ntfs_bad_inode+0x88/0x9c fs/ntfs3/fsntfs.c:885 attr_set_size+0x27d0/0x3430 fs/ntfs3/attrib.c:880 ntfs_extend_mft+0x264/0x3f0 fs/ntfs3/fsntfs.c:498 ntfs_look_free_mft+0x350/0xd1c fs/ntfs3/fsntfs.c:561 ni_create_attr_list+0x738/0xfb0 fs/ntfs3/frecord.c:873 ni_ins_attr_ext+0x300/0xa10 fs/ntfs3/frecord.c:968 ni_insert_attr+0x304/0x7bc fs/ntfs3/frecord.c:1135 ni_insert_resident+0x100/0x384 fs/ntfs3/frecord.c:1519 ntfs_set_ea+0xacc/0x136c fs/ntfs3/xattr.c:398 ntfs_save_wsl_perm+0x118/0x418 fs/ntfs3/xattr.c:929 ntfs3_setattr+0x410/0x974 fs/ntfs3/file.c:817 notify_change+0xc24/0xec0 fs/attr.c:482 chown_common+0x4e8/0x7d8 fs/open.c:736 do_fchownat+0x15c/0x234 fs/open.c:767 __do_sys_fchownat fs/open.c:782 [inline] __se_sys_fchownat fs/open.c:779 [inline] __arm64_sys_fchownat+0xb8/0xd4 fs/open.c:779 __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:142 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206 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:581 -> #1 (&ni->file.run_lock#2){++++}-{3:3}: down_write+0x5c/0x88 kernel/locking/rwsem.c:1573 ntfs_extend_mft+0x120/0x3f0 fs/ntfs3/fsntfs.c:482 ntfs_look_free_mft+0x350/0xd1c fs/ntfs3/fsntfs.c:561 ni_create_attr_list+0x738/0xfb0 fs/ntfs3/frecord.c:873 ni_ins_attr_ext+0x300/0xa10 fs/ntfs3/frecord.c:968 ni_insert_attr+0x304/0x7bc fs/ntfs3/frecord.c:1135 ni_insert_resident+0x100/0x384 fs/ntfs3/frecord.c:1519 ntfs_set_ea+0xacc/0x136c fs/ntfs3/xattr.c:398 ntfs_save_wsl_perm+0x118/0x418 fs/ntfs3/xattr.c:929 ntfs3_setattr+0x410/0x974 fs/ntfs3/file.c:817 notify_change+0xc24/0xec0 fs/attr.c:482 chown_common+0x4e8/0x7d8 fs/open.c:736 do_fchownat+0x15c/0x234 fs/open.c:767 __do_sys_fchownat fs/open.c:782 [inline] __se_sys_fchownat fs/open.c:779 [inline] __arm64_sys_fchownat+0xb8/0xd4 fs/open.c:779 __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:142 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206 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:581 -> #0 (&wnd->rw_lock/1){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3098 [inline] check_prevs_add kernel/locking/lockdep.c:3217 [inline] validate_chain kernel/locking/lockdep.c:3832 [inline] __lock_acquire+0x3338/0x764c kernel/locking/lockdep.c:5056 lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5669 down_write_nested+0x64/0x94 kernel/locking/rwsem.c:1689 ntfs_mark_rec_free+0x48/0x270 fs/ntfs3/fsntfs.c:713 ni_write_inode+0x3f0/0xfb8 fs/ntfs3/frecord.c:3332 ntfs3_write_inode+0x70/0x98 fs/ntfs3/inode.c:1020 write_inode fs/fs-writeback.c:1440 [inline] __writeback_single_inode+0x614/0x1770 fs/fs-writeback.c:1652 writeback_sb_inodes+0x978/0x16c0 fs/fs-writeback.c:1878 wb_writeback+0x414/0x1130 fs/fs-writeback.c:2052 wb_do_writeback fs/fs-writeback.c:2195 [inline] wb_workfn+0x3a8/0x1034 fs/fs-writeback.c:2235 process_one_work+0x7ac/0x1404 kernel/workqueue.c:2289 worker_thread+0x8e4/0xfec kernel/workqueue.c:2436 kthread+0x24c/0x2d4 kernel/kthread.c:376 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 other info that might help us debug this: Chain exists of: &wnd->rw_lock/1 --> &ni->file.run_lock#2 --> &ni->ni_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&ni->ni_lock); lock(&ni->file.run_lock#2); lock(&ni->ni_lock); lock(&wnd->rw_lock/1); *** DEADLOCK *** 3 locks held by kworker/u4:1/11: #0: ffff0000c0e3d938 ((wq_completion)writeback){+.+.}-{0:0}, at: process_one_work+0x664/0x1404 kernel/workqueue.c:2262 #1: ffff800019b67c20 ((work_completion)(&(&wb->dwork)->work)){+.+.}-{0:0}, at: process_one_work+0x6a8/0x1404 kernel/workqueue.c:2264 #2: ffff00011e3d4ac0 (&ni->ni_lock){+.+.}-{3:3}, at: ni_trylock fs/ntfs3/ntfs_fs.h:1123 [inline] #2: ffff00011e3d4ac0 (&ni->ni_lock){+.+.}-{3:3}, at: ni_write_inode+0x134/0xfb8 fs/ntfs3/frecord.c:3240 stack backtrace: CPU: 0 PID: 11 Comm: kworker/u4:1 Not tainted 6.1.22-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023 Workqueue: writeback wb_workfn (flush-7:5) 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/0x5c lib/dump_stack.c:113 print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2056 check_noncircular+0x2cc/0x378 kernel/locking/lockdep.c:2178 check_prev_add kernel/locking/lockdep.c:3098 [inline] check_prevs_add kernel/locking/lockdep.c:3217 [inline] validate_chain kernel/locking/lockdep.c:3832 [inline] __lock_acquire+0x3338/0x764c kernel/locking/lockdep.c:5056 lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5669 down_write_nested+0x64/0x94 kernel/locking/rwsem.c:1689 ntfs_mark_rec_free+0x48/0x270 fs/ntfs3/fsntfs.c:713 ni_write_inode+0x3f0/0xfb8 fs/ntfs3/frecord.c:3332 ntfs3_write_inode+0x70/0x98 fs/ntfs3/inode.c:1020 write_inode fs/fs-writeback.c:1440 [inline] __writeback_single_inode+0x614/0x1770 fs/fs-writeback.c:1652 writeback_sb_inodes+0x978/0x16c0 fs/fs-writeback.c:1878 wb_writeback+0x414/0x1130 fs/fs-writeback.c:2052 wb_do_writeback fs/fs-writeback.c:2195 [inline] wb_workfn+0x3a8/0x1034 fs/fs-writeback.c:2235 process_one_work+0x7ac/0x1404 kernel/workqueue.c:2289 worker_thread+0x8e4/0xfec kernel/workqueue.c:2436 kthread+0x24c/0x2d4 kernel/kthread.c:376 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860