* [Devel] [PATCH hci-8.2 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks
@ 2026-11-27 11:15 Alexander Ivanov
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 1/7] dm-qcow2: always resubmit delayed ENOSPC requests in presuspend Alexander Ivanov
` (7 more replies)
0 siblings, 8 replies; 15+ messages in thread
From: Alexander Ivanov @ 2026-11-27 11:15 UTC (permalink / raw)
To: andrey.zhadchenko; +Cc: devel
dm-qcow2 and dm-ploop delay a request that fails with ENOSPC, retry
it every 20 seconds and report the error with a dm event. QEMU cannot
wait for dm events or send dm messages without CAP_SYS_ADMIN, so a VM
on a vhost-blk disk is never paused and just hangs until space is
freed.
ENOSPC of a VM is to be held in vhost-blk instead: it keeps the failed
request out of the used ring and signals QEMU, which pauses the VM
with io-error and resubmits the request on resume or after migration.
For that the error has to reach vhost-blk, so the dm targets get a
table argument that turns their delay off. Containers keep the delay.
Patches 1-3 fix the existing ENOSPC delay of dm-qcow2:
- a suspend stalled by a request delayed while the timer runs
- a retry postponed indefinitely by new failures
- a WARN on a read failing with ENOSPC, fatal with panic_on_warn
Patches 4-5 fix the same in dm-ploop:
- a retry postponed indefinitely by new failures
- a WARN on a flush or a read failing with ENOSPC
Patches 6-7 add the report_enospc table argument to dm-qcow2 and
dm-ploop. Userspace passes it with every table it loads, and the
table status shows it.
The vhost-blk, QEMU, ploop.ovz and libvirt changes follow as separate
series.
https://virtuozzo.atlassian.net/browse/VSTOR-152175
Assisted-by: LLM
Alexander Ivanov (7):
dm-qcow2: always resubmit delayed ENOSPC requests in presuspend
dm-qcow2: arm the ENOSPC timer only for the first delayed request
dm-qcow2: drop the WARN on a read failing with ENOSPC
dm-ploop: arm the ENOSPC timer only for the first delayed request
dm-ploop: drop the WARN on a non-write request failing with ENOSPC
dm-qcow2: add the report_enospc table argument
dm-ploop: add the report_enospc table argument
drivers/md/dm-ploop-map.c | 23 +++++++++++------------
drivers/md/dm-ploop-target.c | 9 ++++++++-
drivers/md/dm-ploop.h | 1 +
drivers/md/dm-qcow2-map.c | 23 +++++++++++------------
drivers/md/dm-qcow2-target.c | 29 ++++++++++++++++++++++++-----
drivers/md/dm-qcow2.h | 1 +
6 files changed, 56 insertions(+), 30 deletions(-)
--
2.53.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Devel] [PATCH hci-8.2 1/7] dm-qcow2: always resubmit delayed ENOSPC requests in presuspend
2026-11-27 11:15 [Devel] [PATCH hci-8.2 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Alexander Ivanov
@ 2026-11-27 11:15 ` Alexander Ivanov
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 2/7] dm-qcow2: arm the ENOSPC timer only for the first delayed request Alexander Ivanov
` (6 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Alexander Ivanov @ 2026-11-27 11:15 UTC (permalink / raw)
To: andrey.zhadchenko; +Cc: devel
qcow2_presuspend() skips resubmitting tgt->enospc_qios when
timer_delete_sync_try() finds qcow2_enospc_timer() running, assuming
the callback resubmits them. But the callback takes the list at its
start, so a request delayed after that stays on the list, and suspend
waits until the timer this request armed fires.
Wait for the callback with timer_delete_sync() and resubmit the list
unconditionally. wants_suspend is already set, so no request is
delayed after that.
https://virtuozzo.atlassian.net/browse/VSTOR-152175
Fixes: 2f9926b51be7 ("dm-qcow2: Rename MERGE_QIOS_MAX")
Feature: dm-qcow2: block device over QCOW2 files driver
Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
---
drivers/md/dm-qcow2-target.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/md/dm-qcow2-target.c b/drivers/md/dm-qcow2-target.c
index d445bfe1232a..f41fd1be4c00 100644
--- a/drivers/md/dm-qcow2-target.c
+++ b/drivers/md/dm-qcow2-target.c
@@ -1166,8 +1166,8 @@ static void qcow2_presuspend(struct dm_target *ti)
qcow2_set_service_operations(ti, false);
qcow2_set_wants_suspend(ti, true);
- if (timer_delete_sync_try(&tgt->enospc_timer) != -1)
- qcow2_enospc_timer(&tgt->enospc_timer);
+ timer_delete_sync(&tgt->enospc_timer);
+ qcow2_enospc_timer(&tgt->enospc_timer);
}
static void qcow2_presuspend_undo(struct dm_target *ti)
{
--
2.53.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Devel] [PATCH hci-8.2 2/7] dm-qcow2: arm the ENOSPC timer only for the first delayed request
2026-11-27 11:15 [Devel] [PATCH hci-8.2 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Alexander Ivanov
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 1/7] dm-qcow2: always resubmit delayed ENOSPC requests in presuspend Alexander Ivanov
@ 2026-11-27 11:15 ` Alexander Ivanov
2026-11-27 11:51 ` Konstantin Khorenko
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 3/7] dm-qcow2: drop the WARN on a read failing with ENOSPC Alexander Ivanov
` (5 subsequent siblings)
7 siblings, 1 reply; 15+ messages in thread
From: Alexander Ivanov @ 2026-11-27 11:15 UTC (permalink / raw)
To: andrey.zhadchenko; +Cc: devel
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@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
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Devel] [PATCH hci-8.2 3/7] dm-qcow2: drop the WARN on a read failing with ENOSPC
2026-11-27 11:15 [Devel] [PATCH hci-8.2 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Alexander Ivanov
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 1/7] dm-qcow2: always resubmit delayed ENOSPC requests in presuspend Alexander Ivanov
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 2/7] dm-qcow2: arm the ENOSPC timer only for the first delayed request Alexander Ivanov
@ 2026-11-27 11:15 ` Alexander Ivanov
2026-11-27 11:51 ` Konstantin Khorenko
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 4/7] dm-ploop: arm the ENOSPC timer only for the first delayed request Alexander Ivanov
` (4 subsequent siblings)
7 siblings, 1 reply; 15+ messages in thread
From: Alexander Ivanov @ 2026-11-27 11:15 UTC (permalink / raw)
To: andrey.zhadchenko; +Cc: devel
qrq_endio() warns when a request other than a write or a flush fails
with ENOSPC. But the error comes from the image file's read_iter, and
a FUSE server may return ENOSPC for a read. A WARN on an error of the
lower file system takes the node down with panic_on_warn.
Such a read is still delayed and retried, as before.
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@virtuozzo.com>
---
drivers/md/dm-qcow2-map.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c
index 9c955bb54de8..dfda7fe8bb8e 100644
--- a/drivers/md/dm-qcow2-map.c
+++ b/drivers/md/dm-qcow2-map.c
@@ -4667,12 +4667,9 @@ static void qrq_endio(struct qcow2_target *tgt, struct qio *qio,
* timeout. Note, that we do not handle merge here: merge
* callers receive -ENOSPC synchronous without intermediaries.
*/
- if (unlikely(bi_status == BLK_STS_NOSPC)) {
- WARN_ON_ONCE(!op_is_write(qio->bi_op) &&
- qio->bi_op != REQ_OP_FLUSH);
- if (qcow2_try_delay_enospc(tgt, qrq, qio))
- return;
- }
+ if (unlikely(bi_status == BLK_STS_NOSPC) &&
+ qcow2_try_delay_enospc(tgt, qrq, qio))
+ return;
mempool_free(qrq, tgt->qrq_pool);
dm_complete_request(rq, bi_status);
--
2.53.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Devel] [PATCH hci-8.2 4/7] dm-ploop: arm the ENOSPC timer only for the first delayed request
2026-11-27 11:15 [Devel] [PATCH hci-8.2 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Alexander Ivanov
` (2 preceding siblings ...)
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 3/7] dm-qcow2: drop the WARN on a read failing with ENOSPC Alexander Ivanov
@ 2026-11-27 11:15 ` Alexander Ivanov
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 5/7] dm-ploop: drop the WARN on a non-write request failing with ENOSPC Alexander Ivanov
` (3 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Alexander Ivanov @ 2026-11-27 11:15 UTC (permalink / raw)
To: andrey.zhadchenko; +Cc: devel
Every delayed pio rearms ploop->enospc_timer, so while new requests
keep failing the delayed ones are never retried. A container that keeps
writing to a full disk is enough to postpone the retry indefinitely.
Arm the timer when llist_add() finds the delay list empty, so the
delayed requests are retried a fixed period after the first of them
failed.
https://virtuozzo.atlassian.net/browse/VSTOR-152175
Fixes: 90bb85536272 ("dm-ploop: Add ploop target driver")
Feature: dm-ploop: ploop target driver
Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
---
drivers/md/dm-ploop-map.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index c62b414862b1..213f32a8e18d 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -194,9 +194,8 @@ static bool ploop_try_delay_enospc(struct ploop_rq *prq, struct pio *pio)
pr_err_once(PL_FMT("underlying disk is almost full"),
ploop_device_name(ploop));
ploop->event_enospc = true;
- llist_add((struct llist_node *)(&pio->list), &ploop->enospc_pios);
-
- mod_timer(&ploop->enospc_timer, jiffies + PLOOP_ENOSPC_TIMEOUT);
+ if (llist_add((struct llist_node *)(&pio->list), &ploop->enospc_pios))
+ mod_timer(&ploop->enospc_timer, jiffies + PLOOP_ENOSPC_TIMEOUT);
schedule_work(&ploop->event_work);
spin_unlock_irqrestore(&ploop->deferred_lock, flags);
--
2.53.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Devel] [PATCH hci-8.2 5/7] dm-ploop: drop the WARN on a non-write request failing with ENOSPC
2026-11-27 11:15 [Devel] [PATCH hci-8.2 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Alexander Ivanov
` (3 preceding siblings ...)
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 4/7] dm-ploop: arm the ENOSPC timer only for the first delayed request Alexander Ivanov
@ 2026-11-27 11:15 ` Alexander Ivanov
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 6/7] dm-qcow2: add the report_enospc table argument Alexander Ivanov
` (2 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Alexander Ivanov @ 2026-11-27 11:15 UTC (permalink / raw)
To: andrey.zhadchenko; +Cc: devel
ploop_prq_endio() warns when a request other than a write fails with
ENOSPC. But such requests fail so on errors of the lower file system:
- a flush, when vfs_fsync() of the top delta returns ENOSPC, as
process_ploop_fsync_work() passes the error to every flush pio
- a read, when a FUSE server returns ENOSPC for it
A WARN on an error of the lower file system takes the node down with
panic_on_warn.
Such a request is still delayed and retried, as before.
https://virtuozzo.atlassian.net/browse/VSTOR-152175
Fixes: 90bb85536272 ("dm-ploop: Add ploop target driver")
Feature: dm-ploop: ploop target driver
Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
---
drivers/md/dm-ploop-map.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 213f32a8e18d..131102da4c0a 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -219,11 +219,9 @@ static void ploop_prq_endio(struct pio *pio, void *prq_ptr,
* timeout. Note, that we do not handle merge here: merge
* callers receive -ENOSPC synchronous without intermediaries.
*/
- if (unlikely(bi_status == BLK_STS_NOSPC)) {
- WARN_ON_ONCE(!op_is_write(pio->bi_op));
- if (ploop_try_delay_enospc(prq, pio))
- return;
- }
+ if (unlikely(bi_status == BLK_STS_NOSPC) &&
+ ploop_try_delay_enospc(prq, pio))
+ return;
mempool_free(prq, pio->ploop->prq_pool);
dm_complete_request(rq, bi_status);
--
2.53.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Devel] [PATCH hci-8.2 6/7] dm-qcow2: add the report_enospc table argument
2026-11-27 11:15 [Devel] [PATCH hci-8.2 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Alexander Ivanov
` (4 preceding siblings ...)
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 5/7] dm-ploop: drop the WARN on a non-write request failing with ENOSPC Alexander Ivanov
@ 2026-11-27 11:15 ` Alexander Ivanov
2026-11-27 11:51 ` Konstantin Khorenko
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 7/7] dm-ploop: " Alexander Ivanov
2026-11-27 11:51 ` [Devel] [PATCH hci-8.2 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Konstantin Khorenko
7 siblings, 1 reply; 15+ messages in thread
From: Alexander Ivanov @ 2026-11-27 11:15 UTC (permalink / raw)
To: andrey.zhadchenko; +Cc: devel
A request failing with ENOSPC is delayed in dm-qcow2 and resubmitted
every 20 seconds, and the error is reported with a dm event. A
vhost-blk disk is controlled by QEMU, which cannot wait for dm events
or send dm messages without CAP_SYS_ADMIN. So for a VM the request
just hangs until space is freed, and the VM is never paused.
vhost-blk is to hold a request failed with ENOSPC itself and let QEMU
pause the VM and resubmit it on resume, as QEMU does for its own disks
with werror=enospc. That needs the error to reach vhost-blk.
With the optional first table argument report_enospc, such a request
is completed with BLK_STS_NOSPC at once, and no dm event is raised.
Without it nothing changes, which containers rely on.
A flag set by a message would be lost on every table reload, such as
a snapshot or a migration, as the reload creates a new target. So it
is a table argument, which userspace passes with every table it loads.
The table status gets a flags field like the one of dm-ploop: r for
report_enospc, s for an ENOSPC event not yet read by userspace, and o
when no flag is set.
https://virtuozzo.atlassian.net/browse/VSTOR-152175
Feature: dm-qcow2: block device over QCOW2 files driver
Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
---
drivers/md/dm-qcow2-map.c | 11 ++++++-----
drivers/md/dm-qcow2-target.c | 25 ++++++++++++++++++++++---
drivers/md/dm-qcow2.h | 1 +
3 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c
index dfda7fe8bb8e..7a9d8a610a6e 100644
--- a/drivers/md/dm-qcow2-map.c
+++ b/drivers/md/dm-qcow2-map.c
@@ -4662,12 +4662,13 @@ static void qrq_endio(struct qcow2_target *tgt, struct qio *qio,
kvfree(qrq->bvec);
/*
* Here is exit point for rq, and here we handle ENOSPC.
- * Embedded qios will be reinitialized like they've just
- * came from upper dm level, and later resubmitted after
- * timeout. Note, that we do not handle merge here: merge
- * callers receive -ENOSPC synchronous without intermediaries.
+ * Unless report_enospc is set, embedded qios will be
+ * reinitialized like they've just came from upper dm level,
+ * and later resubmitted after timeout. Note, that we do not
+ * handle merge here: merge callers receive -ENOSPC synchronous
+ * without intermediaries.
*/
- if (unlikely(bi_status == BLK_STS_NOSPC) &&
+ if (unlikely(bi_status == BLK_STS_NOSPC) && !tgt->report_enospc &&
qcow2_try_delay_enospc(tgt, qrq, qio))
return;
diff --git a/drivers/md/dm-qcow2-target.c b/drivers/md/dm-qcow2-target.c
index f41fd1be4c00..46324ee35005 100644
--- a/drivers/md/dm-qcow2-target.c
+++ b/drivers/md/dm-qcow2-target.c
@@ -1024,6 +1024,17 @@ static int qcow2_ctr(struct dm_target *ti, unsigned int argc, char **argv)
tgt = alloc_qcow2_target(ti);
if (!tgt)
return -ENOMEM;
+
+ if (!strcmp(argv[0], "report_enospc")) {
+ tgt->report_enospc = true;
+ argc--;
+ argv++;
+ if (!argc) {
+ ti->error = "No image";
+ ret = -EINVAL;
+ goto err;
+ }
+ }
/*
* Userspace passes deltas in bottom, ..., top order,
* but we attach it vise versa: from top to bottom.
@@ -1139,6 +1150,7 @@ static void qcow2_status(struct dm_target *ti, status_type_t type,
{
struct qcow2_target *tgt = to_qcow2_target(ti);
struct QCowHeader *hdr;
+ char stat[4], *p = stat;
unsigned int sz = 0;
struct qcow2 *qcow2;
u8 ref_index;
@@ -1150,8 +1162,15 @@ static void qcow2_status(struct dm_target *ti, status_type_t type,
result[0] = '\0';
break;
case STATUSTYPE_TABLE:
- DMEMIT("%u v%u %llu", qcow2->img_id + 1, hdr->version,
- to_sector(qcow2->clu_size));
+ if (READ_ONCE(tgt->event_enospc))
+ *p++ = 's';
+ if (tgt->report_enospc)
+ *p++ = 'r';
+ if (p == stat)
+ *p++ = 'o';
+ *p = '\0';
+ DMEMIT("%u v%u %llu %s", qcow2->img_id + 1, hdr->version,
+ to_sector(qcow2->clu_size), stat);
break;
case STATUSTYPE_IMA:
result[0] = '\0';
@@ -1236,7 +1255,7 @@ static void qcow2_resume(struct dm_target *ti)
static struct target_type qcow2_target = {
.name = "qcow2",
- .version = {1, 0, 0},
+ .version = {1, 1, 0},
.features = DM_TARGET_SINGLETON,
.module = THIS_MODULE,
.ctr = qcow2_ctr,
diff --git a/drivers/md/dm-qcow2.h b/drivers/md/dm-qcow2.h
index 4acddbe7c95f..f0179b331097 100644
--- a/drivers/md/dm-qcow2.h
+++ b/drivers/md/dm-qcow2.h
@@ -209,6 +209,7 @@ struct qcow2_target {
bool md_writeback_error;
bool truncate_error;
bool event_enospc;
+ bool report_enospc;
atomic_t service_qios;
struct wait_queue_head service_wq;
--
2.53.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Devel] [PATCH hci-8.2 7/7] dm-ploop: add the report_enospc table argument
2026-11-27 11:15 [Devel] [PATCH hci-8.2 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Alexander Ivanov
` (5 preceding siblings ...)
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 6/7] dm-qcow2: add the report_enospc table argument Alexander Ivanov
@ 2026-11-27 11:15 ` Alexander Ivanov
2026-11-27 11:51 ` Konstantin Khorenko
2026-11-27 11:51 ` [Devel] [PATCH hci-8.2 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Konstantin Khorenko
7 siblings, 1 reply; 15+ messages in thread
From: Alexander Ivanov @ 2026-11-27 11:15 UTC (permalink / raw)
To: andrey.zhadchenko; +Cc: devel
A request failing with ENOSPC is delayed in dm-ploop and resubmitted
every 20 seconds, and the error is reported with a dm event. A
vhost-blk disk is controlled by QEMU, which cannot wait for dm events
or send dm messages without CAP_SYS_ADMIN. So for a VM the request
just hangs until space is freed, and the VM is never paused.
vhost-blk is to hold a request failed with ENOSPC itself and let QEMU
pause the VM and resubmit it on resume. That needs the error to reach
vhost-blk.
With the optional table argument report_enospc, such a request is
completed with BLK_STS_NOSPC at once, and no dm event is raised.
Without it nothing changes, which containers rely on.
A flag set by a message would be lost on every table reload, as the
reload creates a new target. So it is a table argument, which
userspace passes with every table it loads. The table status shows it
as the 'r' flag.
https://virtuozzo.atlassian.net/browse/VSTOR-152175
Feature: dm-ploop: ploop target driver
Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
---
drivers/md/dm-ploop-map.c | 10 ++++++----
drivers/md/dm-ploop-target.c | 9 ++++++++-
drivers/md/dm-ploop.h | 1 +
3 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 131102da4c0a..66939a6f5d4b 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -214,12 +214,14 @@ static void ploop_prq_endio(struct pio *pio, void *prq_ptr,
css_put(prq->css);
/*
* Here is exit point for rq, and here we handle ENOSPC.
- * Embedded pios will be reinitialized like they've just
- * came from upper dm level, and later resubmitted after
- * timeout. Note, that we do not handle merge here: merge
- * callers receive -ENOSPC synchronous without intermediaries.
+ * Unless report_enospc is set, embedded pios will be
+ * reinitialized like they've just came from upper dm level,
+ * and later resubmitted after timeout. Note, that we do not
+ * handle merge here: merge callers receive -ENOSPC synchronous
+ * without intermediaries.
*/
if (unlikely(bi_status == BLK_STS_NOSPC) &&
+ !pio->ploop->report_enospc &&
ploop_try_delay_enospc(prq, pio))
return;
diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c
index aefb69e8a40b..872bf481281d 100644
--- a/drivers/md/dm-ploop-target.c
+++ b/drivers/md/dm-ploop-target.c
@@ -615,6 +615,11 @@ static int ploop_ctr(struct dm_target *ti, unsigned int argc, char **argv)
EAT_ARG(argc, argv);
continue;
}
+ if (strcmp(argv[0], "report_enospc") == 0) {
+ ploop->report_enospc = true;
+ EAT_ARG(argc, argv);
+ continue;
+ }
#define PLOOP_MD_DELAY_ARG "metadata_delay="
if (strncmp(argv[0], PLOOP_MD_DELAY_ARG, sizeof(PLOOP_MD_DELAY_ARG) - 1) == 0) {
if (kstrtou64(argv[0] + sizeof(PLOOP_MD_DELAY_ARG) - 1, 10,
@@ -722,6 +727,8 @@ static void ploop_status(struct dm_target *ti, status_type_t type,
*p++ = 'n';
if (READ_ONCE(ploop->event_enospc))
*p++ = 's';
+ if (ploop->report_enospc)
+ *p++ = 'r';
if (p == stat)
*p++ = 'o';
if (ploop->skip_off)
@@ -812,7 +819,7 @@ ALLOW_ERROR_INJECTION(ploop_preresume, ERRNO);
static struct target_type ploop_target = {
.name = "ploop",
- .version = {1, 0, 0},
+ .version = {1, 1, 0},
.features = DM_TARGET_SINGLETON,
.module = THIS_MODULE,
.ctr = ploop_ctr,
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index 093b7f9397a4..fbfecf8139f5 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -266,6 +266,7 @@ struct ploop {
struct timer_list enospc_timer;
bool submit_enospc; /* timer expired run pios from dispatcher */
bool event_enospc;
+ bool report_enospc;
loff_t prealloc_size;
loff_t prealloc_in_progress;
--
2.53.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Devel] [PATCH hci-8.2 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks
2026-11-27 11:15 [Devel] [PATCH hci-8.2 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Alexander Ivanov
` (6 preceding siblings ...)
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 7/7] dm-ploop: " Alexander Ivanov
@ 2026-11-27 11:51 ` Konstantin Khorenko
2026-11-30 9:14 ` Alexander Ivanov
7 siblings, 1 reply; 15+ messages in thread
From: Konstantin Khorenko @ 2026-11-27 11:51 UTC (permalink / raw)
To: Alexander Ivanov; +Cc: devel
I won't apply this version, please send v2 with the changes below.
On Fri, 27 Nov 2026 12:15:43 +0100, Alexander Ivanov wrote:
> table argument that turns their delay off. Containers keep the delay.
1. Cover letter: say that report_enospc without the vhost-blk hold
policy gives the guest an I/O error on ENOSPC, and name the vhost-blk
series by its subject: it is already posted.
2. Cover letter: name the ploop.ovz, QEMU and libvirt series this needs.
3. Patch 6: drop the 's' status flag.
4. Patches 6 and 7: say that the target version goes to 1.1.0.
5. Patch 6: name the reloads that need the argument, and say that the
status line of every qcow2 device changes.
6. Patch 3: name the vstorage kio read path, and say why 12ab90fbc953
kept the WARN on reads.
7. Patch 2: arm the timer next to list_add_tail().
> Patches 6-7 add the report_enospc table argument to dm-qcow2 and
> dm-ploop. Userspace passes it with every table it loads, and the
> table status shows it.
Items 1 and 2. Today ploop.ovz does not pass it: dm_reload_imglist()
builds the table from the fds only, so a snapshot, a grow, a merge or a
replace brings the delay back and the VM hangs again. The ploop.ovz
branch for VSTOR-152175 still sends the withdrawn error_policy=, which
this kernel rejects. So "passes" is a requirement on series that are
not posted yet; say so and name them.
> Patches 4-5 fix the same in dm-ploop:
dm-ploop needs no presuspend fix, ploop_presuspend() already resubmits
the delayed requests unconditionally. Say that, so nobody looks for the
missing third patch.
> dm-qcow2 and dm-ploop delay a request that fails with ENOSPC, retry
> it every 20 seconds and report the error with a dm event.
Before patches 2 and 4 every new failure rearms the timer, so the retry
is not every 20 seconds; patches 2 and 4 make it so.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Devel] [PATCH hci-8.2 3/7] dm-qcow2: drop the WARN on a read failing with ENOSPC
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 3/7] dm-qcow2: drop the WARN on a read failing with ENOSPC Alexander Ivanov
@ 2026-11-27 11:51 ` Konstantin Khorenko
0 siblings, 0 replies; 15+ messages in thread
From: Konstantin Khorenko @ 2026-11-27 11:51 UTC (permalink / raw)
To: Alexander Ivanov; +Cc: devel
Item 6 of the cover letter reply.
On Fri, 27 Nov 2026 12:15:46 +0100, Alexander Ivanov wrote:
> qrq_endio() warns when a request other than a write or a flush fails
> with ENOSPC. But the error comes from the image file's read_iter, and
> a FUSE server may return ENOSPC for a read.
Name the path that does it: vstorage kio, ioreq_complete() in
fs/fuse/kio/pcs/fuse_io.c, turns PCS_REQ_F_NOSPACE into -ENOSPC for
any request, reads included. And say in one line why 12ab90fbc953
("dm-qcow2: fix WARN in qrq_endio() on flush failing with ENOSPC")
two weeks ago let the WARN stay for reads: a reader of both commits
will ask.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Devel] [PATCH hci-8.2 7/7] dm-ploop: add the report_enospc table argument
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 7/7] dm-ploop: " Alexander Ivanov
@ 2026-11-27 11:51 ` Konstantin Khorenko
0 siblings, 0 replies; 15+ messages in thread
From: Konstantin Khorenko @ 2026-11-27 11:51 UTC (permalink / raw)
To: Alexander Ivanov; +Cc: devel
Items 4 and 5 of the cover letter reply.
On Fri, 27 Nov 2026 12:15:50 +0100, Alexander Ivanov wrote:
> A flag set by a message would be lost on every table reload, as the
> reload creates a new target. So it is a table argument, which
> userspace passes with every table it loads. The table status shows it
> as the 'r' flag.
Same as in patch 6: name the reloads that must pass it, and say that
the target version goes to 1.1.0 for userspace to check.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Devel] [PATCH hci-8.2 2/7] dm-qcow2: arm the ENOSPC timer only for the first delayed request
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 2/7] dm-qcow2: arm the ENOSPC timer only for the first delayed request Alexander Ivanov
@ 2026-11-27 11:51 ` Konstantin Khorenko
0 siblings, 0 replies; 15+ messages in thread
From: Konstantin Khorenko @ 2026-11-27 11:51 UTC (permalink / raw)
To: Alexander Ivanov; +Cc: devel
Item 7 of the cover letter reply.
On Fri, 27 Nov 2026 12:15:45 +0100, Alexander Ivanov wrote:
> + 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);
Arm the timer right after list_add_tail(), as patch 4 does in dm-ploop,
and drop the "first" local: the wants_suspend path jumps to unlock:
with first always false, so the check there only hides that.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Devel] [PATCH hci-8.2 6/7] dm-qcow2: add the report_enospc table argument
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 6/7] dm-qcow2: add the report_enospc table argument Alexander Ivanov
@ 2026-11-27 11:51 ` Konstantin Khorenko
0 siblings, 0 replies; 15+ messages in thread
From: Konstantin Khorenko @ 2026-11-27 11:51 UTC (permalink / raw)
To: Alexander Ivanov; +Cc: devel
Items 3, 4 and 5 of the cover letter reply.
On Fri, 27 Nov 2026 12:15:49 +0100, Alexander Ivanov wrote:
> + if (READ_ONCE(tgt->event_enospc))
> + *p++ = 's';
Drop the 's' flag. With report_enospc set event_enospc is never set,
so 's' never shows next to 'r', and nothing reads it: libploop parses
only the first field of the qcow2 status line. If something is to read
it, send it as its own patch and name the reader.
> A flag set by a message would be lost on every table reload, such as
> a snapshot or a migration, as the reload creates a new target. So it
> is a table argument, which userspace passes with every table it loads.
A table argument is lost the same way when userspace does not pass it.
Name the reloads libploop does on its own (snapshot, grow and merge
through dm_reload_imglist(), the push-backup switch) and say they all
must pass it. Also say that the status line of every qcow2 device gets
the new field ("1 v3 128" becomes "1 v3 128 o" or "... r"), and that
the target version goes to 1.1.0, which userspace checks before
passing the argument: an older kernel rejects the table.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Devel] [PATCH hci-8.2 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks
2026-11-27 11:51 ` [Devel] [PATCH hci-8.2 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Konstantin Khorenko
@ 2026-11-30 9:14 ` Alexander Ivanov
2026-11-30 16:27 ` Konstantin Khorenko
0 siblings, 1 reply; 15+ messages in thread
From: Alexander Ivanov @ 2026-11-30 9:14 UTC (permalink / raw)
To: Konstantin Khorenko; +Cc: devel
On 11/27/26 12:51, Konstantin Khorenko wrote:
> I won't apply this version, please send v2 with the changes below.
>
> On Fri, 27 Nov 2026 12:15:43 +0100, Alexander Ivanov wrote:
>> table argument that turns their delay off. Containers keep the delay.
> 1. Cover letter: say that report_enospc without the vhost-blk hold
> policy gives the guest an I/O error on ENOSPC, and name the vhost-blk
> series by its subject: it is already posted.
> 2. Cover letter: name the ploop.ovz, QEMU and libvirt series this needs.
> 3. Patch 6: drop the 's' status flag.
Why we shouldn't do it similar to ploop?
> 4. Patches 6 and 7: say that the target version goes to 1.1.0.
It's apparently what we want.
> 5. Patch 6: name the reloads that need the argument, and say that the
> status line of every qcow2 device changes.
Added a note about it to the commit message.
> 6. Patch 3: name the vstorage kio read path, and say why 12ab90fbc953
> kept the WARN on reads.
> 7. Patch 2: arm the timer next to list_add_tail().
Fixed.
>> Patches 6-7 add the report_enospc table argument to dm-qcow2 and
>> dm-ploop. Userspace passes it with every table it loads, and the
>> table status shows it.
> Items 1 and 2. Today ploop.ovz does not pass it: dm_reload_imglist()
> builds the table from the fds only, so a snapshot, a grow, a merge or a
> replace brings the delay back and the VM hangs again. The ploop.ovz
> branch for VSTOR-152175 still sends the withdrawn error_policy=, which
> this kernel rejects. So "passes" is a requirement on series that are
> not posted yet; say so and name them.
The PR was updated.
>> Patches 4-5 fix the same in dm-ploop:
> dm-ploop needs no presuspend fix, ploop_presuspend() already resubmits
> the delayed requests unconditionally. Say that, so nobody looks for the
> missing third patch.
>
>> dm-qcow2 and dm-ploop delay a request that fails with ENOSPC, retry
>> it every 20 seconds and report the error with a dm event.
> Before patches 2 and 4 every new failure rearms the timer, so the retry
> is not every 20 seconds; patches 2 and 4 make it so.
>
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Devel] [PATCH hci-8.2 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks
2026-11-30 9:14 ` Alexander Ivanov
@ 2026-11-30 16:27 ` Konstantin Khorenko
0 siblings, 0 replies; 15+ messages in thread
From: Konstantin Khorenko @ 2026-11-30 16:27 UTC (permalink / raw)
To: Alexander Ivanov; +Cc: devel
On 2026-11-30 10:14 +0100, Alexander Ivanov wrote:
>
> On 11/27/26 12:51, Konstantin Khorenko wrote:
> > I won't apply this version, please send v2 with the changes below.
> >
> > On Fri, 27 Nov 2026 12:15:43 +0100, Alexander Ivanov wrote:
> >> table argument that turns their delay off. Containers keep the delay.
> > 1. Cover letter: say that report_enospc without the vhost-blk hold
> > policy gives the guest an I/O error on ENOSPC, and name the vhost-blk
> > series by its subject: it is already posted.
> > 2. Cover letter: name the ploop.ovz, QEMU and libvirt series this needs.
> > 3. Patch 6: drop the 's' status flag.
> Why we shouldn't do it similar to ploop?
You are right, keep it. 's' means the same as in dm-ploop
(518fb63ec6ffc): a request is delayed on ENOSPC. Containers keep the
delay and will show it, and the ploop.ovz PR looks only for 'r'.
Item 3 is withdrawn.
> > 4. Patches 6 and 7: say that the target version goes to 1.1.0.
> It's apparently what we want.
Yes, the bump is right, I only ask to mention it in the commit
messages.
> > 5. Patch 6: name the reloads that need the argument, and say that the
> > status line of every qcow2 device changes.
> Added a note about it to the commit message.
> > 6. Patch 3: name the vstorage kio read path, and say why 12ab90fbc953
> > kept the WARN on reads.
> > 7. Patch 2: arm the timer next to list_add_tail().
> Fixed.
> >> Patches 6-7 add the report_enospc table argument to dm-qcow2 and
> >> dm-ploop. Userspace passes it with every table it loads, and the
> >> table status shows it.
> > Items 1 and 2. Today ploop.ovz does not pass it: dm_reload_imglist()
> > builds the table from the fds only, so a snapshot, a grow, a merge or a
> > replace brings the delay back and the VM hangs again. The ploop.ovz
> > branch for VSTOR-152175 still sends the withdrawn error_policy=, which
> > this kernel rejects. So "passes" is a requirement on series that are
> > not posted yet; say so and name them.
> The PR was updated.
Thanks, dm_reload_imglist() keeps report_enospc now. Please name that
PR and the QEMU and libvirt series in the v2 cover letter, together
with items 1 and 6 and the notes on dm-ploop presuspend and on the
20 seconds retry, which are still open.
> >> Patches 4-5 fix the same in dm-ploop:
> > dm-ploop needs no presuspend fix, ploop_presuspend() already resubmits
> > the delayed requests unconditionally. Say that, so nobody looks for the
> > missing third patch.
> >
> >> dm-qcow2 and dm-ploop delay a request that fails with ENOSPC, retry
> >> it every 20 seconds and report the error with a dm event.
> > Before patches 2 and 4 every new failure rearms the timer, so the retry
> > is not every 20 seconds; patches 2 and 4 make it so.
> >
> _______________________________________________
> Devel mailing list
> Devel@openvz.org
> https://lists.openvz.org/mailman/listinfo/devel
>
>
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2026-11-30 16:28 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-27 11:15 [Devel] [PATCH hci-8.2 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Alexander Ivanov
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 1/7] dm-qcow2: always resubmit delayed ENOSPC requests in presuspend Alexander Ivanov
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 2/7] dm-qcow2: arm the ENOSPC timer only for the first delayed request Alexander Ivanov
2026-11-27 11:51 ` Konstantin Khorenko
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 3/7] dm-qcow2: drop the WARN on a read failing with ENOSPC Alexander Ivanov
2026-11-27 11:51 ` Konstantin Khorenko
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 4/7] dm-ploop: arm the ENOSPC timer only for the first delayed request Alexander Ivanov
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 5/7] dm-ploop: drop the WARN on a non-write request failing with ENOSPC Alexander Ivanov
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 6/7] dm-qcow2: add the report_enospc table argument Alexander Ivanov
2026-11-27 11:51 ` Konstantin Khorenko
2026-11-27 11:15 ` [Devel] [PATCH hci-8.2 7/7] dm-ploop: " Alexander Ivanov
2026-11-27 11:51 ` Konstantin Khorenko
2026-11-27 11:51 ` [Devel] [PATCH hci-8.2 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Konstantin Khorenko
2026-11-30 9:14 ` Alexander Ivanov
2026-11-30 16:27 ` Konstantin Khorenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.