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

shuo chen <[email protected]> Tue, 4 Aug 2026 17:31:42 +0800
Newsgroups org.kernel.vger.linux-ext4
Message-ID <[email protected]>
On Mon, Aug 03, 2026 at 03:47:18PM +0200, Jan Kara wrote:
> 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).
Thank you for the review.
After reconsideration, I realized this patch actually causes a lost wakeup 
in some scenarios, so it should be withdrawn.
I will withdraw this patch. Sorry for the noise,and thank you for your time.
> 
> 								Honza
> -- 
> Jan Kara <[email protected]>
> SUSE Labs, CR