FAILED: patch "[PATCH] dm: fail a REQ_PREFLUSH bio with data when its preflush fails" failed to apply to 5.10-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x e92cd41e8e5ee5616c6c7cd4378661d942f0a7c0
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026112518-retype-seldom-2c33@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From e92cd41e8e5ee5616c6c7cd4378661d942f0a7c0 Mon Sep 17 00:00:00 2001
From: Daejun Park <[email protected]>
Date: Thu, 12 Nov 2026 10:35:29 +0900
Subject: [PATCH] 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.
drivers/md/dm.c +2 -2
@@ -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);
Sasha Levin
maintainerPATCH 1/1 dm: fail a REQ_PREFLUSH bio with data when its preflush fails
From: Daejun Park <[email protected]>
[ Upstream commit e92cd41e8e5ee5616c6c7cd4378661d942f0a7c0 ]
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.
--- drivers/md/dm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/md/dm.c +3 -2
@@ -894,7 +894,8 @@ void dm_io_dec_pending(struct dm_io *io, blk_status_t error)if (io_error ==BLK_STS_DM_REQUEUE )return ; -if ((bio->bi_opf &REQ_PREFLUSH ) && bio->bi_iter.bi_size) { +if ((bio->bi_opf &REQ_PREFLUSH ) && bio->bi_iter.bi_size && + !io_error) {/* * Preflush done for flush with data, reissue * without REQ_PREFLUSH.
@@ -902,7 +903,7 @@ void dm_io_dec_pending(struct dm_io *io, blk_status_t error) 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);
Signature · 1 line
2.53.0