[PATCH 3/3] jbd2: check return value of blkdev_issue_flush() for async commits
From: guolingxing
Date: Mon Oct 12 2026 - 07:59:50 EST
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>
---
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 99477e9c78c7..32ca502603be 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 err = blkdev_issue_flush(journal->j_dev);
+
+ if (err)
+ jbd2_journal_abort(journal, err);
}
if (err)
--
2.34.1