[Devel] [PATCH hci-8.1 v12 12/12] dm-qcow2: fix WARN in qrq_endio() on flush failing with ENOSPC

Alexander Ivanov alexander.ivanov at virtuozzo.com
Tue Nov 10 10:51:40 MSK 2026


A REQ_OP_FLUSH request is completed by do_qcow2_fsync_work() with
errno_to_blk_status() of the vfs_fsync() result, so a failed fsync
with -ENOSPC ends it with BLK_STS_NOSPC. qrq_endio() then hits
WARN_ON_ONCE(!op_is_write()), as op_is_write(REQ_OP_FLUSH) is false.
With panic_on_warn this takes the node down.

fsync returns ENOSPC on file systems that allocate on writeback (NFS,
FUSE, thin or reflink backends), and when ext4 or xfs report a failed
delayed write. Delaying and resubmitting the flush is already correct,
so only let the WARN accept REQ_OP_FLUSH.

Fixes: 7d49e18c5c36 ("dm-qcow2: Pause IO and notify about ENOSPC events")
https://virtuozzo.atlassian.net/browse/VSTOR-148171
Feature: dm-qcow2: block device over QCOW2 files driver

Signed-off-by: Alexander Ivanov <alexander.ivanov at virtuozzo.com>
---
 drivers/md/dm-qcow2-map.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c
index 823b2e23644f..c2154c4f6f76 100644
--- a/drivers/md/dm-qcow2-map.c
+++ b/drivers/md/dm-qcow2-map.c
@@ -4491,7 +4491,8 @@ static void qrq_endio(struct qcow2_target *tgt, struct qio *qio,
 	 * callers receive -ENOSPC synchronous without intermediaries.
 	 */
 	if (unlikely(bi_status == BLK_STS_NOSPC)) {
-		WARN_ON_ONCE(!op_is_write(qio->bi_op));
+		WARN_ON_ONCE(!op_is_write(qio->bi_op) &&
+			     qio->bi_op != REQ_OP_FLUSH);
 		if (qcow2_try_delay_enospc(tgt, qrq, qio))
 			return;
 	}
-- 
2.53.0



More information about the Devel mailing list