Re: [PATCH v2 3/3] jbd2: check return value of blkdev_issue_flush() for async commits
From: Jan Kara
Date: Tue Oct 13 2026 - 08:36:52 EST
On Tue 13-10-26 01:40:28, guolingxing wrote:
> When asynchronous commits are enabled, jbd2_commit_transaction()
> calls blkdev_issue_flush() on the journal device to make the commit
> record permanent. However the return value is ignored so if the
> flush fails, the transaction is considered committed although the
> commit record may have never reached the disk. Abort the journal
> when the flush fails, as we already do when waiting for the commit
> record fails.
>
> Fixes: f73bee49855f ("jbd2: Modify ASYNC_COMMIT code to not rely on queue draining on barrier")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: guolingxing <guolingxing@xxxxxxxxxx>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@xxxxxxx>
Honza
> ---
> fs/jbd2/commit.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
> index 8c561e42b60a..4e8ebce34077 100644
> --- a/fs/jbd2/commit.c
> +++ b/fs/jbd2/commit.c
> @@ -912,7 +912,10 @@ void jbd2_journal_commit_transaction(journal_t *journal)
> stats.run.rs_blocks_logged++;
> if (jbd2_has_feature_async_commit(journal) &&
> journal->j_flags & JBD2_BARRIER) {
> - blkdev_issue_flush(journal->j_dev);
> + int flush_err = blkdev_issue_flush(journal->j_dev);
> +
> + if (!err)
> + err = flush_err;
> }
>
> if (err)
> --
> 2.34.1
>
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR