Re: [RESEND PATCH] jbd2:remove unnecessary finish_wait call in jbd2_journal_wait_updates

Jan Kara <[email protected]> Mon, 3 Aug 2026 15:47:18 +0200
Newsgroups org.kernel.vger.linux-ext4
Message-ID <xwlk2l2v7qbfdnuzjrqm3utqd55uzfgqttzetqfl4ffjmnbrdp@unafpyi34kf4>
On Mon 03-08-26 20:35:39, shuo chen wrote:
> merge transaction and atomic_read(&transaction->t_updates) check.
> remove redundant finish_wait call.
> 
> Signed-off-by: shuo chen <[email protected]>

The changelog should mention what is the motivation of the patch. Simple
cleanup?

> ---
>  fs/jbd2/transaction.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
> index 5cc7d097b2ac..0f193d02a054 100644
> --- a/fs/jbd2/transaction.c
> +++ b/fs/jbd2/transaction.c
> @@ -831,15 +831,12 @@ void jbd2_journal_wait_updates(journal_t *journal)
>  		 */
>  		transaction_t *transaction = journal->j_running_transaction;
>  
> -		if (!transaction)
> +		if (!transaction || !atomic_read(&transaction->t_updates))
>  			break;
>  
>  		prepare_to_wait(&journal->j_wait_updates, &wait,
>  				TASK_UNINTERRUPTIBLE);
> -		if (!atomic_read(&transaction->t_updates)) {
> -			finish_wait(&journal->j_wait_updates, &wait);
> -			break;
> -		}
> +

This introduces a race with stop_this_handle() possibly causing a lost
wakeup (I can see Sashiko noticed as well).

								Honza
-- 
Jan Kara <[email protected]>
SUSE Labs, CR