====================================================== WARNING: possible circular locking dependency detected 6.2.0-next-20230303 #1 Not tainted ------------------------------------------------------ kworker/u4:0/9 is trying to acquire lock: ffff88800ff723f8 (&journal->j_checkpoint_mutex){+.+.}-{3:3}, at: __jbd2_log_wait_for_space+0x238/0x4b0 but task is already holding lock: ffff88800ff70b90 (&sbi->s_writepages_rwsem){++++}-{0:0}, at: do_writepages+0x1ad/0x650 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&sbi->s_writepages_rwsem){++++}-{0:0}: ext4_writepages+0x1a9/0x5e0 do_writepages+0x1ad/0x650 filemap_fdatawrite_wbc+0x14b/0x1b0 __filemap_fdatawrite_range+0xba/0x100 filemap_write_and_wait_range+0xa5/0x130 __iomap_dio_rw+0x5ea/0x1ce0 iomap_dio_rw+0x40/0xa0 ext4_file_read_iter+0x2f4/0x4a0 generic_file_splice_read+0x18b/0x4d0 do_splice_to+0x1bc/0x240 splice_direct_to_actor+0x2b0/0x8c0 do_splice_direct+0x1bc/0x290 do_sendfile+0xb1d/0x12b0 __x64_sys_sendfile64+0x1d5/0x210 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc -> #1 (&sb->s_type->i_mutex_key#6){++++}-{3:3}: down_read+0x3d/0x50 ext4_bmap+0x52/0x470 bmap+0xb0/0x130 jbd2_journal_bmap+0xac/0x1d0 jbd2_journal_flush+0x87f/0xc90 __ext4_ioctl+0x9fd/0x4330 __x64_sys_ioctl+0x19e/0x210 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc -> #0 (&journal->j_checkpoint_mutex){+.+.}-{3:3}: __lock_acquire+0x2d56/0x6380 lock_acquire.part.0+0xea/0x320 mutex_lock_io_nested+0x149/0x1300 __jbd2_log_wait_for_space+0x238/0x4b0 add_transaction_credits+0xa42/0xb80 start_this_handle+0x3a6/0x14d0 jbd2__journal_start+0x394/0x6b0 __ext4_journal_start_sb+0x4c2/0x6f0 ext4_do_writepages+0xbb5/0x33f0 ext4_writepages+0x274/0x5e0 do_writepages+0x1ad/0x650 __writeback_single_inode+0x105/0xfe0 writeback_sb_inodes+0x546/0xed0 __writeback_inodes_wb+0xbe/0x270 wb_writeback+0x749/0xbb0 wb_workfn+0x7be/0x1110 process_one_work+0xa0f/0x1790 worker_thread+0x63b/0x1260 kthread+0x2e9/0x3a0 ret_from_fork+0x2c/0x50 other info that might help us debug this: Chain exists of: &journal->j_checkpoint_mutex --> &sb->s_type->i_mutex_key#6 --> &sbi->s_writepages_rwsem Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&sbi->s_writepages_rwsem); lock(&sb->s_type->i_mutex_key#6); lock(&sbi->s_writepages_rwsem); lock(&journal->j_checkpoint_mutex); *** DEADLOCK *** 4 locks held by kworker/u4:0/9: #0: ffff888008f58138 ((wq_completion)writeback){+.+.}-{0:0}, at: process_one_work+0x90d/0x1790 #1: ffff888008d47db0 ((work_completion)(&(&wb->dwork)->work)){+.+.}-{0:0}, at: process_one_work+0x941/0x1790 #2: ffff88800ff660e0 (&type->s_umount_key#42){++++}-{3:3}, at: trylock_super+0x21/0x110 #3: ffff88800ff70b90 (&sbi->s_writepages_rwsem){++++}-{0:0}, at: do_writepages+0x1ad/0x650 stack backtrace: CPU: 0 PID: 9 Comm: kworker/u4:0 Not tainted 6.2.0-next-20230303 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 Workqueue: writeback wb_workfn (flush-8:0) Call Trace: dump_stack_lvl+0x91/0xf0 check_noncircular+0x263/0x2e0 __lock_acquire+0x2d56/0x6380 lock_acquire.part.0+0xea/0x320 mutex_lock_io_nested+0x149/0x1300 __jbd2_log_wait_for_space+0x238/0x4b0 add_transaction_credits+0xa42/0xb80 start_this_handle+0x3a6/0x14d0 jbd2__journal_start+0x394/0x6b0 __ext4_journal_start_sb+0x4c2/0x6f0 ext4_do_writepages+0xbb5/0x33f0 ext4_writepages+0x274/0x5e0 do_writepages+0x1ad/0x650 __writeback_single_inode+0x105/0xfe0 writeback_sb_inodes+0x546/0xed0 __writeback_inodes_wb+0xbe/0x270 wb_writeback+0x749/0xbb0 wb_workfn+0x7be/0x1110 process_one_work+0xa0f/0x1790 worker_thread+0x63b/0x1260 kthread+0x2e9/0x3a0 ret_from_fork+0x2c/0x50 Bluetooth: hci0: ACL packet for unknown connection handle 200 Bluetooth: hci0: ACL packet for unknown connection handle 200