Re: [PATCH] jbd2: prevent softlockup in jbd2_log_do_checkpoint()
From: Theodore Ts'o
Date: Thu Aug 14 2025 - 10:56:09 EST
On Tue, 12 Aug 2025 14:37:52 +0800, libaokun@xxxxxxxxxxxxxxx wrote:
> Both jbd2_log_do_checkpoint() and jbd2_journal_shrink_checkpoint_list()
> periodically release j_list_lock after processing a batch of buffers to
> avoid long hold times on the j_list_lock. However, since both functions
> contend for j_list_lock, the combined time spent waiting and processing
> can be significant.
>
> jbd2_journal_shrink_checkpoint_list() explicitly calls cond_resched() when
> need_resched() is true to avoid softlockups during prolonged operations.
> But jbd2_log_do_checkpoint() only exits its loop when need_resched() is
> true, relying on potentially sleeping functions like __flush_batch() or
> wait_on_buffer() to trigger rescheduling. If those functions do not sleep,
> the kernel may hit a softlockup.
>
> [...]
Applied, thanks!
[1/1] jbd2: prevent softlockup in jbd2_log_do_checkpoint()
commit: 9d98cf4632258720f18265a058e62fde120c0151
Best regards,
--
Theodore Ts'o <tytso@xxxxxxx>