summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaejun Park <daejun7.park@samsung.com>2026-11-12 10:35:29 +0900
committerMikulas Patocka <mpatocka@redhat.com>2026-11-13 22:18:14 +0100
commite92cd41e8e5ee5616c6c7cd4378661d942f0a7c0 (patch)
treeb0fce2cfd1ec4872a9df68b48df763df69b475b5
parent46af2c975958119290ddcd984a98491966123a7b (diff)
dm: fail a REQ_PREFLUSH bio with data when its preflush fails
For a bio with REQ_PREFLUSH and data, dm core may send an empty flush first. If the flush fails, __dm_io_complete() still reissues the bio without REQ_PREFLUSH and drops the error. When that write succeeds, the XFS log keeps running and fsync() can return 0. End the bio with the flush error instead of writing the data, as blk-mq does. Fixes: 6a8736d10cb4 ("dm: relax ordering of bio-based flush implementation") Cc: stable@vger.kernel.org Signed-off-by: Daejun Park <daejun7.park@samsung.com> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
-rw-r--r--drivers/md/dm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index a73355c0125c..38eaae8ac9b4 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -983,7 +983,7 @@ static void __dm_io_complete(struct dm_io *io, bool first_stage)
if (requeued)
return;
- if (unlikely(requeue_flush_with_data)) {
+ if (unlikely(requeue_flush_with_data) && !io_error) {
/*
* Preflush done for flush with data, reissue
* without REQ_PREFLUSH.
@@ -991,7 +991,7 @@ static void __dm_io_complete(struct dm_io *io, bool first_stage)
bio->bi_opf &= ~REQ_PREFLUSH;
queue_io(md, bio);
} else {
- /* done with normal IO or empty flush */
+ /* done with normal IO, empty flush or failed preflush */
if (io_error)
bio->bi_status = io_error;
bio_endio(bio);