====================================================== WARNING: possible circular locking dependency detected 6.7.0-rc7-syzkaller-g8735c7c84d1b #0 Not tainted ------------------------------------------------------ kworker/u4:10/2450 is trying to acquire lock: ffff8880682c0940 (&rl->lock){++++}-{3:3}, at: ntfs_read_block fs/ntfs/aops.c:242 [inline] ffff8880682c0940 (&rl->lock){++++}-{3:3}, at: ntfs_read_folio+0x12fc/0x23b0 fs/ntfs/aops.c:430 but task is already holding lock: ffff8880682c3310 (&ni->mrec_lock){+.+.}-{3:3}, at: map_mft_record+0x48/0x630 fs/ntfs/mft.c:154 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&ni->mrec_lock){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x132/0xd60 kernel/locking/mutex.c:747 map_mft_record+0x48/0x630 fs/ntfs/mft.c:154 ntfs_attr_extend_allocation+0x535/0x4340 fs/ntfs/attrib.c:2002 ntfs_prepare_file_for_write fs/ntfs/file.c:391 [inline] ntfs_file_write_iter+0x37a/0x1960 fs/ntfs/file.c:1907 call_write_iter include/linux/fs.h:2020 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x78e/0xb20 fs/read_write.c:584 ksys_write+0x19c/0x2c0 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b -> #0 (&rl->lock){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x3a1d/0x7fb0 kernel/locking/lockdep.c:5137 lock_acquire+0x1df/0x520 kernel/locking/lockdep.c:5754 down_read+0xad/0xa30 kernel/locking/rwsem.c:1526 ntfs_read_block fs/ntfs/aops.c:242 [inline] ntfs_read_folio+0x12fc/0x23b0 fs/ntfs/aops.c:430 filemap_read_folio+0x198/0x760 mm/filemap.c:2323 do_read_cache_folio+0x134/0x800 mm/filemap.c:3700 do_read_cache_page+0x30/0x1f0 mm/filemap.c:3766 read_mapping_page include/linux/pagemap.h:871 [inline] ntfs_map_page fs/ntfs/aops.h:75 [inline] ntfs_sync_mft_mirror+0x25b/0x1ac0 fs/ntfs/mft.c:480 write_mft_record_nolock+0x1151/0x18d0 fs/ntfs/mft.c:787 write_mft_record+0x149/0x300 fs/ntfs/mft.h:95 __ntfs_write_inode+0x6ff/0xbb0 fs/ntfs/inode.c:3052 write_inode fs/fs-writeback.c:1473 [inline] __writeback_single_inode+0x69b/0xf90 fs/fs-writeback.c:1690 writeback_sb_inodes+0x8df/0x1210 fs/fs-writeback.c:1916 wb_writeback+0x449/0xc50 fs/fs-writeback.c:2092 wb_do_writeback fs/fs-writeback.c:2239 [inline] wb_workfn+0x3fc/0xfe0 fs/fs-writeback.c:2279 process_one_work kernel/workqueue.c:2627 [inline] process_scheduled_works+0x90b/0x1400 kernel/workqueue.c:2700 worker_thread+0xa5b/0xff0 kernel/workqueue.c:2781 kthread+0x2cf/0x360 kernel/kthread.c:388 ret_from_fork+0x44/0x70 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&ni->mrec_lock); lock(&rl->lock); lock(&ni->mrec_lock); rlock(&rl->lock); *** DEADLOCK *** 3 locks held by kworker/u4:10/2450: #0: ffff888019649d38 ((wq_completion)writeback){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:2602 [inline] #0: ffff888019649d38 ((wq_completion)writeback){+.+.}-{0:0}, at: process_scheduled_works+0x821/0x1400 kernel/workqueue.c:2700 #1: ffffc90009ef7d20 ((work_completion)(&(&wb->dwork)->work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:2602 [inline] #1: ffffc90009ef7d20 ((work_completion)(&(&wb->dwork)->work)){+.+.}-{0:0}, at: process_scheduled_works+0x821/0x1400 kernel/workqueue.c:2700 #2: ffff8880682c3310 (&ni->mrec_lock){+.+.}-{3:3}, at: map_mft_record+0x48/0x630 fs/ntfs/mft.c:154 stack backtrace: CPU: 0 PID: 2450 Comm: kworker/u4:10 Not tainted 6.7.0-rc7-syzkaller-g8735c7c84d1b #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023 Workqueue: writeback wb_workfn (flush-7:3) Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106 check_noncircular+0x371/0x4a0 kernel/locking/lockdep.c:2187 check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x3a1d/0x7fb0 kernel/locking/lockdep.c:5137 lock_acquire+0x1df/0x520 kernel/locking/lockdep.c:5754 down_read+0xad/0xa30 kernel/locking/rwsem.c:1526 ntfs_read_block fs/ntfs/aops.c:242 [inline] ntfs_read_folio+0x12fc/0x23b0 fs/ntfs/aops.c:430 filemap_read_folio+0x198/0x760 mm/filemap.c:2323 do_read_cache_folio+0x134/0x800 mm/filemap.c:3700 do_read_cache_page+0x30/0x1f0 mm/filemap.c:3766 read_mapping_page include/linux/pagemap.h:871 [inline] ntfs_map_page fs/ntfs/aops.h:75 [inline] ntfs_sync_mft_mirror+0x25b/0x1ac0 fs/ntfs/mft.c:480 write_mft_record_nolock+0x1151/0x18d0 fs/ntfs/mft.c:787 write_mft_record+0x149/0x300 fs/ntfs/mft.h:95 __ntfs_write_inode+0x6ff/0xbb0 fs/ntfs/inode.c:3052 write_inode fs/fs-writeback.c:1473 [inline] __writeback_single_inode+0x69b/0xf90 fs/fs-writeback.c:1690 writeback_sb_inodes+0x8df/0x1210 fs/fs-writeback.c:1916 wb_writeback+0x449/0xc50 fs/fs-writeback.c:2092 wb_do_writeback fs/fs-writeback.c:2239 [inline] wb_workfn+0x3fc/0xfe0 fs/fs-writeback.c:2279 process_one_work kernel/workqueue.c:2627 [inline] process_scheduled_works+0x90b/0x1400 kernel/workqueue.c:2700 worker_thread+0xa5b/0xff0 kernel/workqueue.c:2781 kthread+0x2cf/0x360 kernel/kthread.c:388 ret_from_fork+0x44/0x70 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242