[PATCH 2/3] ext4: check return value of blkdev_issue_flush() when starting a fast commit

From: guolingxing

Date: Tue Oct 13 2026 - 02:31:52 EST


When the file system device differs from the journal device, a cache
flush is issued on the file system device before fast commit blocks
are written, but the return value is ignored. If the cache flush
fails, the fast commit blocks are written and the fast commit
completes anyway, even though the updates covered by the preceding
transactions may not be on stable storage yet, so the fast commit may
provide guarantees it cannot keep.

Check the return value of blkdev_issue_flush() and abort the fast
commit if the cache flush fails. ext4_fc_commit() will then fall back
to a full journal commit, so the caller still gets the expected
durability guarantees.

Fixes: da0c5d2695265 ("ext4: issue fsdev cache flush before starting fast commit")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: guolingxing <guolingxing@xxxxxxxxxx>
---
fs/ext4/fast_commit.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
index 0cac890cf370..ead8b16f9be0 100644
--- a/fs/ext4/fast_commit.c
+++ b/fs/ext4/fast_commit.c
@@ -1425,8 +1425,11 @@ static int ext4_fc_perform_commit(journal_t *journal, tid_t commit_tid)
* Step 5: If file system device is different from journal device,
* issue a cache flush before we start writing fast commit blocks.
*/
- if (journal->j_fs_dev != journal->j_dev)
- blkdev_issue_flush(journal->j_fs_dev);
+ if (journal->j_fs_dev != journal->j_dev) {
+ ret = blkdev_issue_flush(journal->j_fs_dev);
+ if (ret)
+ return ret;
+ }

blk_start_plug(&plug);
alloc_ctx = ext4_fc_lock(sb);
--
2.34.1