====================================================== WARNING: possible circular locking dependency detected 6.1.87-syzkaller #0 Not tainted ------------------------------------------------------ kworker/u4:4/1641 is trying to acquire lock: ffff0000df968940 (&rl->lock){++++}-{3:3}, at: ntfs_read_block fs/ntfs/aops.c:248 [inline] ffff0000df968940 (&rl->lock){++++}-{3:3}, at: ntfs_read_folio+0xf40/0x1d70 fs/ntfs/aops.c:436 but task is already holding lock: ffff0000df96bb50 (&ni->mrec_lock){+.+.}-{3:3}, at: map_mft_record+0x64/0x7b4 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+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 map_mft_record+0x64/0x7b4 fs/ntfs/mft.c:154 ntfs_attr_extend_allocation+0x458/0x3470 fs/ntfs/attrib.c:2002 ntfs_prepare_file_for_write fs/ntfs/file.c:391 [inline] ntfs_file_write_iter+0x2c8/0x17b0 fs/ntfs/file.c:1915 call_write_iter include/linux/fs.h:2265 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x610/0x914 fs/read_write.c:584 ksys_write+0x15c/0x26c fs/read_write.c:637 __do_sys_write fs/read_write.c:649 [inline] __se_sys_write fs/read_write.c:646 [inline] __arm64_sys_write+0x7c/0x90 fs/read_write.c:646 __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:585 -> #0 (&rl->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 down_read+0x64/0x308 kernel/locking/rwsem.c:1520 ntfs_read_block fs/ntfs/aops.c:248 [inline] ntfs_read_folio+0xf40/0x1d70 fs/ntfs/aops.c:436 filemap_read_folio+0x14c/0x39c mm/filemap.c:2461 do_read_cache_folio+0x24c/0x544 mm/filemap.c:3598 do_read_cache_page mm/filemap.c:3640 [inline] read_cache_page+0x6c/0x180 mm/filemap.c:3649 read_mapping_page include/linux/pagemap.h:791 [inline] ntfs_map_page fs/ntfs/aops.h:75 [inline] ntfs_sync_mft_mirror+0x1cc/0x1890 fs/ntfs/mft.c:480 write_mft_record_nolock+0x100c/0x1630 fs/ntfs/mft.c:787 write_mft_record+0x144/0x1bc fs/ntfs/mft.h:95 __ntfs_write_inode+0x5cc/0xa78 fs/ntfs/inode.c:3050 ntfs_write_inode+0x68/0x90 fs/ntfs/super.c:2656 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 __writeback_inodes_wb+0x110/0x39c fs/fs-writeback.c:1974 wb_writeback+0x428/0x1130 fs/fs-writeback.c:2079 wb_check_background_flush fs/fs-writeback.c:2145 [inline] wb_do_writeback fs/fs-writeback.c:2233 [inline] wb_workfn+0xc98/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 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); lock(&rl->lock); *** DEADLOCK *** 4 locks held by kworker/u4:4/1641: #0: ffff0000c2e4d938 ((wq_completion)writeback){+.+.}-{0:0}, at: process_one_work+0x664/0x1404 kernel/workqueue.c:2265 #1: ffff800022be7c20 ((work_completion)(&(&wb->dwork)->work)){+.+.}-{0:0}, at: process_one_work+0x6a8/0x1404 kernel/workqueue.c:2267 #2: ffff0000da0c00e0 (&type->s_umount_key#60){.+.+}-{3:3}, at: trylock_super+0x28/0xf8 fs/super.c:415 #3: ffff0000df96bb50 (&ni->mrec_lock){+.+.}-{3:3}, at: map_mft_record+0x64/0x7b4 fs/ntfs/mft.c:154 stack backtrace: CPU: 0 PID: 1641 Comm: kworker/u4:4 Not tainted 6.1.87-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Workqueue: writeback wb_workfn (flush-7:2) 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: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 down_read+0x64/0x308 kernel/locking/rwsem.c:1520 ntfs_read_block fs/ntfs/aops.c:248 [inline] ntfs_read_folio+0xf40/0x1d70 fs/ntfs/aops.c:436 filemap_read_folio+0x14c/0x39c mm/filemap.c:2461 do_read_cache_folio+0x24c/0x544 mm/filemap.c:3598 do_read_cache_page mm/filemap.c:3640 [inline] read_cache_page+0x6c/0x180 mm/filemap.c:3649 read_mapping_page include/linux/pagemap.h:791 [inline] ntfs_map_page fs/ntfs/aops.h:75 [inline] ntfs_sync_mft_mirror+0x1cc/0x1890 fs/ntfs/mft.c:480 write_mft_record_nolock+0x100c/0x1630 fs/ntfs/mft.c:787 write_mft_record+0x144/0x1bc fs/ntfs/mft.h:95 __ntfs_write_inode+0x5cc/0xa78 fs/ntfs/inode.c:3050 ntfs_write_inode+0x68/0x90 fs/ntfs/super.c:2656 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 __writeback_inodes_wb+0x110/0x39c fs/fs-writeback.c:1974 wb_writeback+0x428/0x1130 fs/fs-writeback.c:2079 wb_check_background_flush fs/fs-writeback.c:2145 [inline] wb_do_writeback fs/fs-writeback.c:2233 [inline] wb_workfn+0xc98/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