Skip to contentSkip to conversation

FAILED: patch "[PATCH] dm-writecache: report I/O error if flush failed" failed to apply to 5.10-stable tree

PATCH New Sasha Levin 1 participant 2 messages Nov 7 – Nov 10

Subsystems (2)
lore
Share & tools
lore

Sasha Levin

author maintainer
#0 lore raw

The 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 78a6afc2999d26e5a30a56db77db34c22b88f5d5
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'

Thanks,
Sasha

------------------ original commit in Linus's tree ------------------

From 78a6afc2999d26e5a30a56db77db34c22b88f5d5 Mon Sep 17 00:00:00 2001
From: Mikulas Patocka <[email protected]>
Date: Wed, 30 Sep 2026 21:38:25 +0200
Subject: [PATCH] dm-writecache: report I/O error if flush failed

There was a bug that if writecache_flush fails due to I/O error, the error is not reported in the FUA bio. This commit fixes it.

Assisted-by opencode:big-pickle
Fixes 48debafe4f2f ("dm: add writecache target")
---
 drivers/md/dm-writecache.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/md/dm-writecache.c +5 -2
index 68e3fb300fc14..e278359cb268e 100644
@@ -1494,10 +1494,13 @@ static enum wc_map_op writecache_map_write(struct dm_writecache *wc, struct bio
 		}
 	} while (bio->bi_iter.bi_size);
 
-	if (unlikely(bio->bi_opf & REQ_FUA || wc->uncommitted_blocks >= wc->autocommit_blocks))
+	if (unlikely(bio->bi_opf & REQ_FUA || wc->uncommitted_blocks >= wc->autocommit_blocks)) {
 		writecache_flush(wc);
-	else
+		if (writecache_has_error(wc))
+			bio->bi_status = BLK_STS_IOERR;
+	} else {
 		writecache_schedule_autocommit(wc);
+	}
 
 	return WC_MAP_SUBMIT;
 }
Signature · 1 line
2.53.0
author maintainer
#1 lore raw

PATCH 1/1 dm-writecache: report I/O error if flush failed

From: Mikulas Patocka <[email protected]>

[ Upstream commit 78a6afc2999d26e5a30a56db77db34c22b88f5d5 ]

There was a bug that if writecache_flush fails due to I/O error, the error is not reported in the FUA bio. This commit fixes it.

Assisted-by opencode:big-pickle
Fixes 48debafe4f2f ("dm: add writecache target")
[ sashal: adapted the change to writecache_map() because writecache_map_write() has not been split out ]
---
 drivers/md/dm-writecache.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/md/dm-writecache.c +5 -2
index 1b7d89794c6a3..f8b671299c854 100644
@@ -1454,10 +1454,13 @@ static int writecache_map(struct dm_target *ti, struct bio *bio)
 		} while (bio->bi_iter.bi_size);
 
 		if (unlikely(bio->bi_opf & REQ_FUA ||
-			     wc->uncommitted_blocks >= wc->autocommit_blocks))
+			     wc->uncommitted_blocks >= wc->autocommit_blocks)) {
 			writecache_flush(wc);
-		else
+			if (writecache_has_error(wc))
+				bio->bi_status = BLK_STS_IOERR;
+		} else {
 			writecache_schedule_autocommit(wc);
+		}
 		goto unlock_submit;
 	}
 
Signature · 1 line
2.53.0