7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mikulas Patocka [ 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 Assisted-by: opencode:big-pickle Cc: stable@vger.kernel.org Fixes: 48debafe4f2f ("dm: add writecache target") Signed-off-by: Sasha Levin --- 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 978646f71f996..5804cbc62a511 100644 --- a/drivers/md/dm-writecache.c +++ b/drivers/md/dm-writecache.c @@ -1493,10 +1493,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; } -- 2.53.0