[Devel] [PATCH hci-8.2 2/7] dm-qcow2: arm the ENOSPC timer only for the first delayed request

Alexander Ivanov alexander.ivanov at virtuozzo.com
Fri Nov 27 14:15:45 MSK 2026


Every delayed request rearms tgt->enospc_timer, so while new requests
keep failing the delayed 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 delay list turns non-empty, so the delayed
requests are retried a fixed period after the first of them failed.

https://virtuozzo.atlassian.net/browse/VSTOR-152175

Fixes: 6e2ec304689f ("dm-qcow2: Pause IO and notify about ENOSPC events")
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 853e7a1230ee..9c955bb54de8 100644
--- a/drivers/md/dm-qcow2-map.c
+++ b/drivers/md/dm-qcow2-map.c
@@ -4627,7 +4627,7 @@ void do_qcow2_fsync_work(struct work_struct *ws)
 
 static bool qcow2_try_delay_enospc(struct qcow2_target *tgt, struct qcow2_rq *qrq, struct qio *qio)
 {
-	bool delayed = true;
+	bool delayed = true, first = false;
 	unsigned long flags;
 
 	spin_lock_irqsave(&tgt->event_lock, flags);
@@ -4641,9 +4641,10 @@ static bool qcow2_try_delay_enospc(struct qcow2_target *tgt, struct qcow2_rq *qr
 	pr_err_once(QCOW2_FMT("underlying disk is almost full"),
 			qcow2_device_name(tgt->ti));
 	tgt->event_enospc = true;
+	first = list_empty(&tgt->enospc_qios);
 	list_add_tail(&qio->link, &tgt->enospc_qios);
 unlock:
-	if (delayed)
+	if (first)
 		mod_timer(&tgt->enospc_timer, jiffies + ENOSPC_TIMEOUT_JI);
 	schedule_work(&tgt->event_work);
 	spin_unlock_irqrestore(&tgt->event_lock, flags);
-- 
2.53.0



More information about the Devel mailing list