Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Mikulas Patocka <mpatocka@redhat.com>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.10.y] dm-writecache: report I/O error if flush failed
Date: Tue, 10 Nov 2026 09:07:57 -0500	[thread overview]
Message-ID: <20261110140733.1828251-1-sashal@kernel.org> (raw)
In-Reply-To: <20261107061802-failed-5.10-78a6afc2999d@kernel.org>

From: Mikulas Patocka <mpatocka@redhat.com>

[ 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.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Assisted-by: opencode:big-pickle
Cc: stable@vger.kernel.org
Fixes: 48debafe4f2f ("dm: add writecache target")
[ sashal: adapted the change to writecache_map() because writecache_map_write() has not been split out ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/md/dm-writecache.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c
index 1b7d89794c6a3..f8b671299c854 100644
--- a/drivers/md/dm-writecache.c
+++ b/drivers/md/dm-writecache.c
@@ -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;
 	}
 
-- 
2.53.0


      reply	other threads:[~2026-11-10 14:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-07 11:18 FAILED: patch "[PATCH] dm-writecache: report I/O error if flush failed" failed to apply to 5.10-stable tree Sasha Levin
2026-11-10 14:07 ` Sasha Levin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261110140733.1828251-1-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox