OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
To: andrey.zhadchenko@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.2 v3 7/7] dm-ploop: add the report_enospc table argument
Date: Tue,  1 Dec 2026 09:50:09 +0100	[thread overview]
Message-ID: <20261201085009.1884844-8-alexander.ivanov@virtuozzo.com> (raw)
In-Reply-To: <20261201085009.1884844-1-alexander.ivanov@virtuozzo.com>

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

  parent reply	other threads:[~2026-12-01  8:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Alexander Ivanov [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261201085009.1884844-8-alexander.ivanov@virtuozzo.com \
    --to=alexander.ivanov@virtuozzo.com \
    --cc=andrey.zhadchenko@virtuozzo.com \
    --cc=devel@openvz.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox