[Devel] [PATCH hci-8.2 v3 7/7] dm-ploop: add the report_enospc table argument
Alexander Ivanov
alexander.ivanov at virtuozzo.com
Tue Dec 1 11:50:09 MSK 2026
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 at virtuozzo.com>
Reviewed-by: Sashiko <no-reply at 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
More information about the Devel
mailing list