* [Devel] [PATCH hci-8.2 v3 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks
@ 2026-12-01 8:50 Alexander Ivanov
2026-12-01 8:50 ` [Devel] [PATCH hci-8.2 v3 1/7] dm-qcow2: always resubmit delayed ENOSPC requests in presuspend Alexander Ivanov
` (8 more replies)
0 siblings, 9 replies; 11+ messages in thread
From: Alexander Ivanov @ 2026-12-01 8:50 UTC (permalink / raw)
To: andrey.zhadchenko; +Cc: devel
dm-qcow2 and dm-ploop delay a request that fails with ENOSPC, retry
it once no request has failed for 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.
Without the hold policy of vhost-blk, report_enospc completes the
request with an error, and the guest gets an I/O error on ENOSPC.
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
dm-ploop needs no presuspend fix: ploop_presuspend() already
resubmits the delayed requests unconditionally.
Patches 6-7 add the report_enospc table argument to dm-qcow2 and
dm-ploop. Userspace has to pass it with every table it loads, and the
table status shows it. Without that, a snapshot, a grow, a merge or a
replace reloads the table without the argument, brings the delay back
and the VM hangs again.
The vhost-blk series goes on top of this one.
The whole feature needs these series:
- vhost-blk: "[PATCH hci-8.2 v3 0/4] drivers/vhost/blk: hold requests
failed with ENOSPC until QEMU resubmits them"
- QEMU: "[PATCH hci-8.2 v3 0/5] vhost-blk: support the werror/rerror
policies"
- ploop.ovz: https://bitbucket.org/openvz/ploop.ovz/pull-requests/530
- libvirt: https://bitbucket.org/openvz/libvirt.ovz/pull-requests/403
v3:
- rebase on top of rh10-6.12.0-211.75.1.26.6.vz10, which has the
VIRTIO_BLK_F_DISCARD series
v2:
- cover letter: say that report_enospc without the vhost-blk hold
policy gives the guest an I/O error, and name the vhost-blk, QEMU,
ploop.ovz and libvirt series
- cover letter: say that dm-ploop needs no presuspend fix, and that
before patches 2 and 4 the retry is not every 20 seconds
- patch 1: say that 2f9926b51be7 replaced del_timer_sync() with
timer_delete_sync_try()
- patch 2: arm the timer next to list_add_tail()
- patch 3: name the vstorage kio read path and why 12ab90fbc953 kept
the WARN on reads
- patches 6-7: say that the target version goes to 1.1.0
- patch 6: name the reloads that need the argument and say that the
status line of every qcow2 device changes
- patch 6: keep the 's' status flag, as dm-ploop shows a pending
ENOSPC event the same way
- rebase on top of the VIRTIO_BLK_F_DISCARD series v4
https://virtuozzo.atlassian.net/browse/VSTOR-152175
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 | 22 ++++++++++------------
drivers/md/dm-qcow2-target.c | 29 ++++++++++++++++++++++++-----
drivers/md/dm-qcow2.h | 1 +
6 files changed, 55 insertions(+), 30 deletions(-)
--
2.53.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Devel] [PATCH hci-8.2 v3 1/7] dm-qcow2: always resubmit delayed ENOSPC requests in presuspend
2026-12-01 8:50 [Devel] [PATCH hci-8.2 v3 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Alexander Ivanov
@ 2026-12-01 8:50 ` Alexander Ivanov
2026-12-01 8:50 ` [Devel] [PATCH hci-8.2 v3 2/7] dm-qcow2: arm the ENOSPC timer only for the first delayed request Alexander Ivanov
` (7 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Alexander Ivanov @ 2026-12-01 8:50 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.
2f9926b51be7 replaced del_timer_sync() there with
timer_delete_sync_try() in passing.
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>
Reviewed-by: Sashiko <no-reply@sashiko.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 a109392b9bdd..dddea4af21a4 100644
--- a/drivers/md/dm-qcow2-target.c
+++ b/drivers/md/dm-qcow2-target.c
@@ -1168,8 +1168,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] 11+ messages in thread
* [Devel] [PATCH hci-8.2 v3 2/7] dm-qcow2: arm the ENOSPC timer only for the first delayed request
2026-12-01 8:50 [Devel] [PATCH hci-8.2 v3 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Alexander Ivanov
2026-12-01 8:50 ` [Devel] [PATCH hci-8.2 v3 1/7] dm-qcow2: always resubmit delayed ENOSPC requests in presuspend Alexander Ivanov
@ 2026-12-01 8:50 ` Alexander Ivanov
2026-12-01 8:50 ` [Devel] [PATCH hci-8.2 v3 3/7] dm-qcow2: drop the WARN on a read failing with ENOSPC Alexander Ivanov
` (6 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Alexander Ivanov @ 2026-12-01 8:50 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>
Reviewed-by: Sashiko <no-reply@sashiko.virtuozzo.com>
---
drivers/md/dm-qcow2-map.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c
index 0313f3189ea7..107091492961 100644
--- a/drivers/md/dm-qcow2-map.c
+++ b/drivers/md/dm-qcow2-map.c
@@ -4707,10 +4707,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;
+ if (list_empty(&tgt->enospc_qios))
+ mod_timer(&tgt->enospc_timer, jiffies + ENOSPC_TIMEOUT_JI);
list_add_tail(&qio->link, &tgt->enospc_qios);
unlock:
- if (delayed)
- 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] 11+ messages in thread
* [Devel] [PATCH hci-8.2 v3 3/7] dm-qcow2: drop the WARN on a read failing with ENOSPC
2026-12-01 8:50 [Devel] [PATCH hci-8.2 v3 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Alexander Ivanov
2026-12-01 8:50 ` [Devel] [PATCH hci-8.2 v3 1/7] dm-qcow2: always resubmit delayed ENOSPC requests in presuspend Alexander Ivanov
2026-12-01 8:50 ` [Devel] [PATCH hci-8.2 v3 2/7] dm-qcow2: arm the ENOSPC timer only for the first delayed request Alexander Ivanov
@ 2026-12-01 8:50 ` Alexander Ivanov
2026-12-01 8:50 ` [Devel] [PATCH hci-8.2 v3 4/7] dm-ploop: arm the ENOSPC timer only for the first delayed request Alexander Ivanov
` (5 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Alexander Ivanov @ 2026-12-01 8:50 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
the file system may return it for a read: vstorage kio, in
ioreq_complete(), turns PCS_REQ_F_NOSPACE into -ENOSPC for any request
type, reads included. A WARN on an error of the lower file system
takes the node down with panic_on_warn.
12ab90fbc953 ("dm-qcow2: fix WARN in qrq_endio() on flush failing with
ENOSPC") let only flushes through, assuming reads never see ENOSPC.
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>
Reviewed-by: Sashiko <no-reply@sashiko.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 107091492961..e0b8a805af34 100644
--- a/drivers/md/dm-qcow2-map.c
+++ b/drivers/md/dm-qcow2-map.c
@@ -4732,12 +4732,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] 11+ messages in thread
* [Devel] [PATCH hci-8.2 v3 4/7] dm-ploop: arm the ENOSPC timer only for the first delayed request
2026-12-01 8:50 [Devel] [PATCH hci-8.2 v3 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Alexander Ivanov
` (2 preceding siblings ...)
2026-12-01 8:50 ` [Devel] [PATCH hci-8.2 v3 3/7] dm-qcow2: drop the WARN on a read failing with ENOSPC Alexander Ivanov
@ 2026-12-01 8:50 ` Alexander Ivanov
2026-12-01 8:50 ` [Devel] [PATCH hci-8.2 v3 5/7] dm-ploop: drop the WARN on a non-write request failing with ENOSPC Alexander Ivanov
` (4 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Alexander Ivanov @ 2026-12-01 8:50 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>
Reviewed-by: Sashiko <no-reply@sashiko.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 a936de6377ef..45e73a8a6272 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] 11+ messages in thread
* [Devel] [PATCH hci-8.2 v3 5/7] dm-ploop: drop the WARN on a non-write request failing with ENOSPC
2026-12-01 8:50 [Devel] [PATCH hci-8.2 v3 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Alexander Ivanov
` (3 preceding siblings ...)
2026-12-01 8:50 ` [Devel] [PATCH hci-8.2 v3 4/7] dm-ploop: arm the ENOSPC timer only for the first delayed request Alexander Ivanov
@ 2026-12-01 8:50 ` Alexander Ivanov
2026-12-01 8:50 ` [Devel] [PATCH hci-8.2 v3 6/7] dm-qcow2: add the report_enospc table argument Alexander Ivanov
` (3 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Alexander Ivanov @ 2026-12-01 8:50 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>
Reviewed-by: Sashiko <no-reply@sashiko.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 45e73a8a6272..5f8de62a7099 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] 11+ messages in thread
* [Devel] [PATCH hci-8.2 v3 6/7] dm-qcow2: add the report_enospc table argument
2026-12-01 8:50 [Devel] [PATCH hci-8.2 v3 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Alexander Ivanov
` (4 preceding siblings ...)
2026-12-01 8:50 ` [Devel] [PATCH hci-8.2 v3 5/7] dm-ploop: drop the WARN on a non-write request failing with ENOSPC Alexander Ivanov
@ 2026-12-01 8:50 ` Alexander Ivanov
2026-12-01 8:54 ` no-reply
2026-12-01 8:50 ` [Devel] [PATCH hci-8.2 v3 7/7] dm-ploop: " Alexander Ivanov
` (2 subsequent siblings)
8 siblings, 1 reply; 11+ messages in thread
From: Alexander Ivanov @ 2026-12-01 8:50 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, as the
reload creates a new target. So it is a table argument, which
userspace has to pass with every table it loads: on a snapshot, a
grow, a merge, a replace and a migration.
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. The field is added to the table line of every
qcow2 device, with or without report_enospc. Userspace reads r back to
pass report_enospc again when it reloads the table.
The target version goes to 1.1.0, as an older kernel rejects the
argument as a wrong fd.
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 e0b8a805af34..2a481d50f0d3 100644
--- a/drivers/md/dm-qcow2-map.c
+++ b/drivers/md/dm-qcow2-map.c
@@ -4727,12 +4727,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 dddea4af21a4..13be646f7a64 100644
--- a/drivers/md/dm-qcow2-target.c
+++ b/drivers/md/dm-qcow2-target.c
@@ -1026,6 +1026,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.
@@ -1141,6 +1152,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;
@@ -1152,8 +1164,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';
@@ -1238,7 +1257,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 | DM_TARGET_NOWAIT,
.module = THIS_MODULE,
.ctr = qcow2_ctr,
diff --git a/drivers/md/dm-qcow2.h b/drivers/md/dm-qcow2.h
index 6c5d3e932691..141103513bdb 100644
--- a/drivers/md/dm-qcow2.h
+++ b/drivers/md/dm-qcow2.h
@@ -211,6 +211,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] 11+ messages in thread
* [Devel] [PATCH hci-8.2 v3 7/7] dm-ploop: add the report_enospc table argument
2026-12-01 8:50 [Devel] [PATCH hci-8.2 v3 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Alexander Ivanov
` (5 preceding siblings ...)
2026-12-01 8:50 ` [Devel] [PATCH hci-8.2 v3 6/7] dm-qcow2: add the report_enospc table argument Alexander Ivanov
@ 2026-12-01 8:50 ` Alexander Ivanov
2026-12-01 15:28 ` [Devel] [PATCH hci-8.2 v3 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Konstantin Khorenko
2026-12-01 15:28 ` Konstantin Khorenko
8 siblings, 0 replies; 11+ messages in thread
From: Alexander Ivanov @ 2026-12-01 8:50 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 has to pass with every table it loads: on a snapshot, a
grow, a merge, a replace and a migration.
The table status shows it as the 'r' flag, which userspace reads back
to pass report_enospc again when it reloads the table. The target
version goes to 1.1.0, as an older kernel takes the argument for a
delta fd and fails the table load with EINVAL.
https://virtuozzo.atlassian.net/browse/VSTOR-152175
Feature: dm-ploop: ploop target driver
Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
Reviewed-by: Sashiko <no-reply@sashiko.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 5f8de62a7099..50b7b33263ec 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 8dd436397acb..23bcc2da4fe4 100644
--- a/drivers/md/dm-ploop-target.c
+++ b/drivers/md/dm-ploop-target.c
@@ -614,6 +614,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,
@@ -718,6 +723,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)
@@ -915,7 +922,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 f76b323ce6c2..d353fcac4fb9 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -273,6 +273,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] 11+ messages in thread
* Re: [Devel] [PATCH hci-8.2 v3 6/7] dm-qcow2: add the report_enospc table argument
2026-12-01 8:50 ` [Devel] [PATCH hci-8.2 v3 6/7] dm-qcow2: add the report_enospc table argument Alexander Ivanov
@ 2026-12-01 8:54 ` no-reply
0 siblings, 0 replies; 11+ messages in thread
From: no-reply @ 2026-12-01 8:54 UTC (permalink / raw)
To: Alexander Ivanov, 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, as the
> [ ... ]
> argument as a wrong fd.
>
> 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>
Sashiko has reviewed this patch and found no issues.
Carry the trailer below into the next revision and Sashiko will not review this patch again.
Reviewed-by: Sashiko <no-reply@sashiko.virtuozzo.com>
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261201085009.1884844-1-alexander.ivanov@virtuozzo.com?part=6
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Devel] [PATCH hci-8.2 v3 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks
2026-12-01 8:50 [Devel] [PATCH hci-8.2 v3 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Alexander Ivanov
` (6 preceding siblings ...)
2026-12-01 8:50 ` [Devel] [PATCH hci-8.2 v3 7/7] dm-ploop: " Alexander Ivanov
@ 2026-12-01 15:28 ` Konstantin Khorenko
2026-12-01 15:28 ` Konstantin Khorenko
8 siblings, 0 replies; 11+ messages in thread
From: Konstantin Khorenko @ 2026-12-01 15:28 UTC (permalink / raw)
To: Alexander Ivanov; +Cc: devel
Applying as is.
On Tue, 1 Dec 2026 09:50:02 +0100, Alexander Ivanov wrote:
> v3:
> - rebase on top of rh10-6.12.0-211.75.1.26.6.vz10, which has the
> VIRTIO_BLK_F_DISCARD series
Thank you. v3 differs from v2 only by the Sashiko trailers, and all
v1 items were done in v2.
Separate patches, not needed for this series. I created a task:
1. scripts/qcow2-dm.sh: get_dev_of_image() takes the last character
of the table line as the image count. You are right that it broke
with 2ab36beebc38, not with this series: the line has ended with
the cluster size since then. Parse the count from its own field,
or drop the script if nobody uses it.
https://virtuozzo.atlassian.net/browse/VSTOR-158256
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Devel] [PATCH hci-8.2 v3 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks
2026-12-01 8:50 [Devel] [PATCH hci-8.2 v3 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Alexander Ivanov
` (7 preceding siblings ...)
2026-12-01 15:28 ` [Devel] [PATCH hci-8.2 v3 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Konstantin Khorenko
@ 2026-12-01 15:28 ` Konstantin Khorenko
8 siblings, 0 replies; 11+ messages in thread
From: Konstantin Khorenko @ 2026-12-01 15:28 UTC (permalink / raw)
To: andrey.zhadchenko, Alexander Ivanov; +Cc: devel
On Tue, 01 Dec 2026 09:50:02 +0100, Alexander Ivanov wrote:
> dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks
>
> dm-qcow2 and dm-ploop delay a request that fails with ENOSPC, retry
> it once no request has failed for 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.
>
> [...]
Applied to branch-rh10-6.12.0-211.75.1.26.x.vz10-ovz, will be released in rh10-6.12.0-211.75.1.26.7.vz10, thanks!
[1/7] dm-qcow2: always resubmit delayed ENOSPC requests in presuspend
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/3eaa4cba13ad
[2/7] dm-qcow2: arm the ENOSPC timer only for the first delayed request
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/2550f7ab6418
[3/7] dm-qcow2: drop the WARN on a read failing with ENOSPC
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/ee2d4fa6f023
[4/7] dm-ploop: arm the ENOSPC timer only for the first delayed request
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/0f6c4804fc9e
[5/7] dm-ploop: drop the WARN on a non-write request failing with ENOSPC
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/6b39aabac955
[6/7] dm-qcow2: add the report_enospc table argument
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/99fefeb741dc
[7/7] dm-ploop: add the report_enospc table argument
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/8e9803fdb520
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-12-01 15:30 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-01 8:50 [Devel] [PATCH hci-8.2 v3 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Alexander Ivanov
2026-12-01 8:50 ` [Devel] [PATCH hci-8.2 v3 1/7] dm-qcow2: always resubmit delayed ENOSPC requests in presuspend Alexander Ivanov
2026-12-01 8:50 ` [Devel] [PATCH hci-8.2 v3 2/7] dm-qcow2: arm the ENOSPC timer only for the first delayed request Alexander Ivanov
2026-12-01 8:50 ` [Devel] [PATCH hci-8.2 v3 3/7] dm-qcow2: drop the WARN on a read failing with ENOSPC Alexander Ivanov
2026-12-01 8:50 ` [Devel] [PATCH hci-8.2 v3 4/7] dm-ploop: arm the ENOSPC timer only for the first delayed request Alexander Ivanov
2026-12-01 8:50 ` [Devel] [PATCH hci-8.2 v3 5/7] dm-ploop: drop the WARN on a non-write request failing with ENOSPC Alexander Ivanov
2026-12-01 8:50 ` [Devel] [PATCH hci-8.2 v3 6/7] dm-qcow2: add the report_enospc table argument Alexander Ivanov
2026-12-01 8:54 ` no-reply
2026-12-01 8:50 ` [Devel] [PATCH hci-8.2 v3 7/7] dm-ploop: " Alexander Ivanov
2026-12-01 15:28 ` [Devel] [PATCH hci-8.2 v3 0/7] dm-qcow2, dm-ploop: report ENOSPC at once for vhost-blk disks Konstantin Khorenko
2026-12-01 15:28 ` Konstantin Khorenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox