====================================================== WARNING: possible circular locking dependency detected 6.5.0-syzkaller-00453-g727dbda16b83 #0 Not tainted ------------------------------------------------------ kworker/u4:5/77 is trying to acquire lock: ffff888075ee19c0 (&rl->lock){++++}-{3:3}, at: ntfs_read_block fs/ntfs/aops.c:248 [inline] ffff888075ee19c0 (&rl->lock){++++}-{3:3}, at: ntfs_read_folio+0x14d5/0x29f0 fs/ntfs/aops.c:436 but task is already holding lock: ffff888075ee7510 (&ni->mrec_lock){+.+.}-{3:3}, at: map_mft_record+0x4c/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+0x1d8/0x2530 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:799 map_mft_record+0x4c/0x630 fs/ntfs/mft.c:154 ntfs_truncate+0x267/0x2890 fs/ntfs/inode.c:2383 ntfs_truncate_vfs fs/ntfs/inode.c:2863 [inline] ntfs_setattr+0x329/0x400 fs/ntfs/inode.c:2915 notify_change+0xb99/0xe60 fs/attr.c:499 do_truncate+0x220/0x300 fs/open.c:66 handle_truncate fs/namei.c:3298 [inline] do_open fs/namei.c:3643 [inline] path_openat+0x2959/0x3180 fs/namei.c:3796 do_filp_open+0x234/0x490 fs/namei.c:3823 do_sys_openat2+0x13e/0x1d0 fs/open.c:1422 do_sys_open fs/open.c:1437 [inline] __do_sys_creat fs/open.c:1513 [inline] __se_sys_creat fs/open.c:1507 [inline] __x64_sys_creat+0x123/0x160 fs/open.c:1507 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 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:3142 [inline] check_prevs_add kernel/locking/lockdep.c:3261 [inline] validate_chain kernel/locking/lockdep.c:3876 [inline] __lock_acquire+0x39ff/0x7f70 kernel/locking/lockdep.c:5144 lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5761 down_read+0x47/0x2f0 kernel/locking/rwsem.c:1520 ntfs_read_block fs/ntfs/aops.c:248 [inline] ntfs_read_folio+0x14d5/0x29f0 fs/ntfs/aops.c:436 filemap_read_folio+0x19d/0x7a0 mm/filemap.c:2394 do_read_cache_folio+0x134/0x820 mm/filemap.c:3701 do_read_cache_page+0x32/0x220 mm/filemap.c:3767 read_mapping_page include/linux/pagemap.h:836 [inline] ntfs_map_page fs/ntfs/aops.h:75 [inline] ntfs_sync_mft_mirror+0x25f/0x1ae0 fs/ntfs/mft.c:480 write_mft_record_nolock+0x1155/0x18e0 fs/ntfs/mft.c:787 write_mft_record+0x149/0x310 fs/ntfs/mft.h:95 __ntfs_write_inode+0x70a/0xbc0 fs/ntfs/inode.c:3051 write_inode fs/fs-writeback.c:1456 [inline] __writeback_single_inode+0x69b/0xfa0 fs/fs-writeback.c:1668 writeback_sb_inodes+0x8e3/0x11d0 fs/fs-writeback.c:1894 __writeback_inodes_wb+0x11b/0x260 fs/fs-writeback.c:1965 wb_writeback+0x461/0xc60 fs/fs-writeback.c:2072 wb_check_background_flush fs/fs-writeback.c:2142 [inline] wb_do_writeback fs/fs-writeback.c:2230 [inline] wb_workfn+0xc6f/0xff0 fs/fs-writeback.c:2257 process_one_work+0x92c/0x12c0 kernel/workqueue.c:2600 worker_thread+0xa63/0x1210 kernel/workqueue.c:2751 kthread+0x2b8/0x350 kernel/kthread.c:389 ret_from_fork+0x2e/0x60 arch/x86/kernel/process.c:145 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304 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 *** 4 locks held by kworker/u4:5/77: #0: ffff888145656938 ((wq_completion)writeback){+.+.}-{0:0}, at: process_one_work+0x7e3/0x12c0 kernel/workqueue.c:2572 #1: ffffc900015e7d00 ((work_completion)(&(&wb->dwork)->work)){+.+.}-{0:0}, at: process_one_work+0x82b/0x12c0 kernel/workqueue.c:2574 #2: ffff88802da360e0 (&type->s_umount_key#66){++++}-{3:3}, at: super_trylock_shared+0x22/0xf0 fs/super.c:597 #3: ffff888075ee7510 (&ni->mrec_lock){+.+.}-{3:3}, at: map_mft_record+0x4c/0x630 fs/ntfs/mft.c:154 stack backtrace: CPU: 0 PID: 77 Comm: kworker/u4:5 Not tainted 6.5.0-syzkaller-00453-g727dbda16b83 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023 Workqueue: writeback wb_workfn (flush-7:3) Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 check_noncircular+0x375/0x4a0 kernel/locking/lockdep.c:2195 check_prev_add kernel/locking/lockdep.c:3142 [inline] check_prevs_add kernel/locking/lockdep.c:3261 [inline] validate_chain kernel/locking/lockdep.c:3876 [inline] __lock_acquire+0x39ff/0x7f70 kernel/locking/lockdep.c:5144 lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5761 down_read+0x47/0x2f0 kernel/locking/rwsem.c:1520 ntfs_read_block fs/ntfs/aops.c:248 [inline] ntfs_read_folio+0x14d5/0x29f0 fs/ntfs/aops.c:436 filemap_read_folio+0x19d/0x7a0 mm/filemap.c:2394 do_read_cache_folio+0x134/0x820 mm/filemap.c:3701 do_read_cache_page+0x32/0x220 mm/filemap.c:3767 read_mapping_page include/linux/pagemap.h:836 [inline] ntfs_map_page fs/ntfs/aops.h:75 [inline] ntfs_sync_mft_mirror+0x25f/0x1ae0 fs/ntfs/mft.c:480 write_mft_record_nolock+0x1155/0x18e0 fs/ntfs/mft.c:787 write_mft_record+0x149/0x310 fs/ntfs/mft.h:95 __ntfs_write_inode+0x70a/0xbc0 fs/ntfs/inode.c:3051 write_inode fs/fs-writeback.c:1456 [inline] __writeback_single_inode+0x69b/0xfa0 fs/fs-writeback.c:1668 writeback_sb_inodes+0x8e3/0x11d0 fs/fs-writeback.c:1894 __writeback_inodes_wb+0x11b/0x260 fs/fs-writeback.c:1965 wb_writeback+0x461/0xc60 fs/fs-writeback.c:2072 wb_check_background_flush fs/fs-writeback.c:2142 [inline] wb_do_writeback fs/fs-writeback.c:2230 [inline] wb_workfn+0xc6f/0xff0 fs/fs-writeback.c:2257 process_one_work+0x92c/0x12c0 kernel/workqueue.c:2600 worker_thread+0xa63/0x1210 kernel/workqueue.c:2751 kthread+0x2b8/0x350 kernel/kthread.c:389 ret_from_fork+0x2e/0x60 arch/x86/kernel/process.c:145 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304