[Devel] [PATCH hci-8.1 4/9] drivers/md/dm-qcow2: arm the hold timer only for the first held request

Alexander Ivanov alexander.ivanov at virtuozzo.com
Mon Nov 16 18:41:14 MSK 2026


Every held request rearms tgt->held_timer, so while new requests keep
failing the held ones are never retried. A guest that keeps writing to
a full disk is enough to postpone the retry indefinitely.

Arm the timer when the held list turns non-empty, so the held requests
are retried a fixed period after the first of them failed.

https://virtuozzo.atlassian.net/browse/VSTOR-152175
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 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c
index b987d459863d..d6f8bcd98a39 100644
--- a/drivers/md/dm-qcow2-map.c
+++ b/drivers/md/dm-qcow2-map.c
@@ -4569,7 +4569,7 @@ void do_qcow2_fsync_work(struct work_struct *ws)
 static bool qcow2_try_hold_error(struct qcow2_target *tgt, struct qcow2_rq *qrq,
 				 struct qio *qio, blk_status_t bi_status)
 {
-	bool held = true;
+	bool held = true, first = false;
 	unsigned long flags;
 
 	if (bi_status != BLK_STS_NOSPC)
@@ -4586,11 +4586,12 @@ static bool qcow2_try_hold_error(struct qcow2_target *tgt, struct qcow2_rq *qrq,
 	pr_err_once(QCOW2_FMT("underlying disk is almost full"),
 			qcow2_device_name(tgt->ti));
 	tgt->event_enospc = true;
+	first = list_empty(&tgt->held_qios);
 	list_add_tail(&qio->link, &tgt->held_qios);
 unlock:
 	spin_unlock_irqrestore(&tgt->event_lock, flags);
 
-	if (held)
+	if (first)
 		mod_timer(&tgt->held_timer, jiffies + HOLD_TIMEOUT_JI);
 	schedule_work(&tgt->event_work);
 
-- 
2.53.0



More information about the Devel mailing list