From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (mail.openvz.org [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 01D1C80031 for ; Tue, 1 Dec 2026 08:51:57 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6B18ohPB021335; Tue, 1 Dec 2026 11:50:44 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6B18ohPB021335 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="HUHa/B24" Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6B18oF5F021213 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 1 Dec 2026 11:50:15 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6B18oF5F021213 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-c504bdea834so813643366b.1 for ; Tue, 01 Dec 2026 00:50:15 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErH66HB2prvDgUzuBoiV2UF6a7mtY9WswTo9YJ9gcUsK0pm+jL2C0FxJhsurZX0uj+NdyWkizA==@openvz.org X-Gm-Message-State: APuU4Z+lqUD15uTe67EHIx2Qezj5cM8psC3oiZADC+MZjMW17VikN6Xu urCBJNpOlX5EbnI7mO/4jq8EqTf00uzhSdzytk3omFR0zHs2pcWP6FOBrtaFXdqTF4YFc36pZhP v1msEg3ZOdkBG6s7ab8oj4aDpQI5uwJ3Uo7n8aZEQxRsQkocFNlOv6w== X-Gm-Gg: AZFdTZcqIlEQw4587nbeKefteQ5usRgADhyVjQiC3Y+pNIY/zX5D6mpmoi3pakfWdBy rvAnG8QolBhi/WJfgLTNSXB91hsE5wLQnqGjAcBDOG5sBe2U+I2T4V/+N7WsSnrX/BLuFWLZ2nn 1P8D5E/VuTt45CWnD6/s7MMIHO40GSuU3Z/D5W4s/y+1h6HcvbNshKzyfI4QMudiB3PyZ8vQ/Pt qaO+dZAwdgfboF7eTQEDPqc5VUgqfqOD1xGpd6l54YM7VnkWqUvDkbtO5uLDe4WRQy1Au2vQXET 5bGRT6SZEb/Of+dYIQBgsBc9nhv7aNiifLWreYw7z30dE2KpLW+T0tG5Hs4ABwZXklRvSbyLXtD AuQvL37PL0CpertionxXiwbnFCbA= X-Received: by 2002:a17:906:f885:b0:c4c:fd37:bb0c with SMTP id a640c23a62f3a-c513aaea94amr2003642666b.29.1796115015048; Tue, 01 Dec 2026 00:50:15 -0800 (PST) X-Received: by 2002:a17:906:f885:b0:c4c:fd37:bb0c with SMTP id a640c23a62f3a-c513aaea94amr2003640866b.29.1796115014524; Tue, 01 Dec 2026 00:50:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1796115014; cv=none; d=google.com; s=arc-20260327; b=hXTWQDkQB6/hrQddoZ6xajVGwGwzB69Tv5Uy5X1qAyo4OVXkbxE7+Y5dxk7TThgPa5 IuKgz51N+NebApSWiBwGtrmDSCOhftJlGJIvLQllQBKZv9lZ8UNksgtPaMuR/VXmp39H N1ZbYI65affBLxlp83XzFM544OJ7I4NeOndlfFx0zCXZnoxpxtGGVCOmnoAYRisgGInv sYyf2GyVGsLcNXgyl3mt60p0ygt8NpP5eLGMG7tWNQXWME1NmAqq3ugOw9niojXgDVxz i4mGvP4pvNFH7Ni9b+x1B1DXkYeIEruRAjqIUTS04R4mVEPIQHQ+ewf7/12lY0Y0XUtN MRxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=6NycpW8E3KqOK+TjN9RrmtALZSIG5tPmNW6WiZUjI70=; fh=CMILZ+goaghq6B4UpCDhf0EQp6kYD0LAlmOkUiVCOvs=; b=UzknVj7ndsJaVmkWL0l/KyVlhTeIpjl7LAYWPV8WyKWu/PRgNoOjBermzPVi7RP/2D K17yK91xCnPI9Pz6xB6OjXzXSVX9VyMzawrF/OUS8PkAZShVBmFZHy4ZiuiwDRDPndm/ 8Q9zc0oUIh/bbGlZb2OwLD7fyzAdEkOvrU5KDRvVYVim4nWLywgA9trMtkPuSoAWSKqn uxMDRFGNoWR453d9WeRjK0ZOXwNQmxn4p5SAXEMzvBwFADOf+wRe1jvX2uOeqMZ+g7LY 6B/uRHHLQCNx973hLnXQGnc5BPUC9f1wDdBYmOYarDwA0D8qCJKxq9pXS6s2/gr9dZDT /wiA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b="HUHa/B24"; spf=pass (google.com: domain of alexander.ivanov@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=alexander.ivanov@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id a640c23a62f3a-c513b073f7dsi2200447866b.255.2026.12.01.00.50.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 00:50:14 -0800 (PST) Received-SPF: pass (google.com: domain of alexander.ivanov@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b="HUHa/B24"; spf=pass (google.com: domain of alexander.ivanov@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=alexander.ivanov@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-ID:Date:Subject:From: Content-Type; bh=6NycpW8E3KqOK+TjN9RrmtALZSIG5tPmNW6WiZUjI70=; b=HUHa/B24QuGN nCPDotEHm4lZbnt4RQAe+wLRAb3B4lLy4OlyDLinGLecQLMXqlE+Q95PoVFRJJQEXmitg/3w8s8Wj FdjdFOC4bcdVI6bGW8zr/VMXLW8Qj6X3AqnZ14IAQGEhgVxyaH/fzaECbFSsUR/9UNZwqDGeh24vu lKNnFUe4PtyGf9LceA8aoA6X8REaRtxdA+HolvUtVUtYdWzekrUXrNNyYh0wt25wOUEyow1jN93vQ aPDWNOgcCXtAGeUETaYnFW/B1fkeYDSDG8C+H0zKKgRQBr3hpkB2kGZuL+aJiWoqy1Sd6XiRkFVP+ UiPeUwGxnS/SsmbUNjmGyA==; Received: from ch-vpn.virtuozzo.com ([130.117.225.6] helo=sky) by relay.virtuozzo.com with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1xYJYf-000HJA-2o; Tue, 01 Dec 2026 09:50:04 +0100 From: Alexander Ivanov To: andrey.zhadchenko@virtuozzo.com Date: Tue, 1 Dec 2026 09:50:08 +0100 Message-ID: <20261201085009.1884844-7-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261201085009.1884844-1-alexander.ivanov@virtuozzo.com> References: <20261201085009.1884844-1-alexander.ivanov@virtuozzo.com> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.2 v3 6/7] dm-qcow2: add the report_enospc table argument X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org 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 --- 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