====================================================== WARNING: possible circular locking dependency detected 6.2.0-next-20230223-syzkaller #0 Not tainted ------------------------------------------------------ kswapd0/80 is trying to acquire lock: ffff8880995bd380 (&rl->lock){+.+.}-{3:3}, at: __ntfs_clear_inode+0x24/0x260 fs/ntfs/inode.c:2189 but task is already holding lock: ffffffff8c8ec5c0 (fs_reclaim){+.+.}-{0:0}, at: set_task_reclaim_state mm/vmscan.c:200 [inline] ffffffff8c8ec5c0 (fs_reclaim){+.+.}-{0:0}, at: balance_pgdat+0x170/0x1ac0 mm/vmscan.c:7338 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (fs_reclaim){+.+.}-{0:0}: __fs_reclaim_acquire mm/page_alloc.c:4730 [inline] fs_reclaim_acquire+0x11d/0x160 mm/page_alloc.c:4744 might_alloc include/linux/sched/mm.h:271 [inline] prepare_alloc_pages+0x159/0x570 mm/page_alloc.c:5376 __alloc_pages+0x149/0x5c0 mm/page_alloc.c:5594 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2283 folio_alloc+0x20/0x70 mm/mempolicy.c:2293 filemap_alloc_folio+0x3ad/0x450 mm/filemap.c:976 do_read_cache_folio+0x193/0x510 mm/filemap.c:3647 do_read_cache_page mm/filemap.c:3749 [inline] read_cache_page+0x5d/0x160 mm/filemap.c:3758 read_mapping_page include/linux/pagemap.h:769 [inline] ntfs_map_page fs/ntfs/aops.h:75 [inline] map_mft_record_page fs/ntfs/mft.c:73 [inline] map_mft_record+0x1df/0x6c0 fs/ntfs/mft.c:156 ntfs_read_locked_inode+0x19c/0x5ae0 fs/ntfs/inode.c:550 ntfs_iget+0x131/0x180 fs/ntfs/inode.c:177 ntfs_lookup+0x2f6/0xbf0 fs/ntfs/namei.c:117 lookup_open.isra.0+0x944/0x1400 fs/namei.c:3394 open_last_lookups fs/namei.c:3484 [inline] path_openat+0x975/0x2750 fs/namei.c:3712 do_filp_open+0x1ba/0x410 fs/namei.c:3742 do_sys_openat2+0x16d/0x4c0 fs/open.c:1312 do_sys_open fs/open.c:1328 [inline] __do_sys_open fs/open.c:1336 [inline] __se_sys_open fs/open.c:1332 [inline] __x64_sys_open+0x11d/0x1c0 fs/open.c:1332 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #1 (&ni->mrec_lock){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1350 kernel/locking/mutex.c:747 map_mft_record+0x40/0x6c0 fs/ntfs/mft.c:154 ntfs_truncate+0x243/0x2a50 fs/ntfs/inode.c:2383 ntfs_truncate_vfs fs/ntfs/inode.c:2862 [inline] ntfs_setattr+0x397/0x560 fs/ntfs/inode.c:2914 notify_change+0xb2c/0x1180 fs/attr.c:482 do_truncate+0x143/0x200 fs/open.c:66 handle_truncate fs/namei.c:3219 [inline] do_open fs/namei.c:3564 [inline] path_openat+0x2083/0x2750 fs/namei.c:3715 do_filp_open+0x1ba/0x410 fs/namei.c:3742 do_sys_openat2+0x16d/0x4c0 fs/open.c:1312 do_sys_open fs/open.c:1328 [inline] __do_sys_openat fs/open.c:1344 [inline] __se_sys_openat fs/open.c:1339 [inline] __x64_sys_openat+0x143/0x1f0 fs/open.c:1339 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #0 (&rl->lock){+.+.}-{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+0x2ec7/0x5d40 kernel/locking/lockdep.c:5056 lock_acquire.part.0+0x11a/0x370 kernel/locking/lockdep.c:5669 down_write+0x92/0x200 kernel/locking/rwsem.c:1573 __ntfs_clear_inode+0x24/0x260 fs/ntfs/inode.c:2189 ntfs_evict_big_inode+0x190/0x520 fs/ntfs/inode.c:2278 evict+0x2ed/0x6b0 fs/inode.c:665 dispose_list+0x117/0x1e0 fs/inode.c:698 prune_icache_sb+0xeb/0x150 fs/inode.c:897 super_cache_scan+0x391/0x590 fs/super.c:106 do_shrink_slab+0x464/0xd20 mm/vmscan.c:853 shrink_slab_memcg mm/vmscan.c:922 [inline] shrink_slab+0x388/0x660 mm/vmscan.c:1001 shrink_one+0x502/0x810 mm/vmscan.c:5343 shrink_many mm/vmscan.c:5394 [inline] lru_gen_shrink_node mm/vmscan.c:5511 [inline] shrink_node+0x2064/0x35f0 mm/vmscan.c:6459 kswapd_shrink_node mm/vmscan.c:7262 [inline] balance_pgdat+0xa02/0x1ac0 mm/vmscan.c:7452 kswapd+0x70b/0x1000 mm/vmscan.c:7712 kthread+0x2e8/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 other info that might help us debug this: Chain exists of: &rl->lock --> &ni->mrec_lock --> fs_reclaim Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(fs_reclaim); lock(&ni->mrec_lock); lock(fs_reclaim); lock(&rl->lock); *** DEADLOCK *** 3 locks held by kswapd0/80: #0: ffffffff8c8ec5c0 (fs_reclaim){+.+.}-{0:0}, at: set_task_reclaim_state mm/vmscan.c:200 [inline] #0: ffffffff8c8ec5c0 (fs_reclaim){+.+.}-{0:0}, at: balance_pgdat+0x170/0x1ac0 mm/vmscan.c:7338 #1: ffffffff8c8a3230 (shrinker_rwsem){++++}-{3:3}, at: shrink_slab_memcg mm/vmscan.c:895 [inline] #1: ffffffff8c8a3230 (shrinker_rwsem){++++}-{3:3}, at: shrink_slab+0x2a0/0x660 mm/vmscan.c:1001 #2: ffff888082cbc0e0 (&type->s_umount_key#67){++++}-{3:3}, at: trylock_super fs/super.c:414 [inline] #2: ffff888082cbc0e0 (&type->s_umount_key#67){++++}-{3:3}, at: super_cache_scan+0x70/0x590 fs/super.c:79 stack backtrace: CPU: 1 PID: 80 Comm: kswapd0 Not tainted 6.2.0-next-20230223-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/16/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106 check_noncircular+0x25f/0x2e0 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+0x2ec7/0x5d40 kernel/locking/lockdep.c:5056 lock_acquire.part.0+0x11a/0x370 kernel/locking/lockdep.c:5669 down_write+0x92/0x200 kernel/locking/rwsem.c:1573 __ntfs_clear_inode+0x24/0x260 fs/ntfs/inode.c:2189 ntfs_evict_big_inode+0x190/0x520 fs/ntfs/inode.c:2278 evict+0x2ed/0x6b0 fs/inode.c:665 dispose_list+0x117/0x1e0 fs/inode.c:698 prune_icache_sb+0xeb/0x150 fs/inode.c:897 super_cache_scan+0x391/0x590 fs/super.c:106 do_shrink_slab+0x464/0xd20 mm/vmscan.c:853 shrink_slab_memcg mm/vmscan.c:922 [inline] shrink_slab+0x388/0x660 mm/vmscan.c:1001 shrink_one+0x502/0x810 mm/vmscan.c:5343 shrink_many mm/vmscan.c:5394 [inline] lru_gen_shrink_node mm/vmscan.c:5511 [inline] shrink_node+0x2064/0x35f0 mm/vmscan.c:6459 kswapd_shrink_node mm/vmscan.c:7262 [inline] balance_pgdat+0xa02/0x1ac0 mm/vmscan.c:7452 kswapd+0x70b/0x1000 mm/vmscan.c:7712 kthread+0x2e8/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308