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 F149580031 for ; Mon, 30 Nov 2026 16:26:34 +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 6AUGPLbk019716; Mon, 30 Nov 2026 19:25:21 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AUGPLbk019716 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="WbrGvBzi" Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AUGP1Hn019613 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Mon, 30 Nov 2026 19:25:01 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AUGP1Hn019613 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-6b3f6d9827eso3723385a12.2 for ; Mon, 30 Nov 2026 08:25:01 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErHCdJE5MF/RRHh7zOguSSpSmL0974mjnGOsVmWSB9JJrp987QC0yT9OL0SThK4vT22IZoq3LA==@openvz.org X-Gm-Message-State: APuU4Z91iR3D8vjgyeoEX4ya1Oi7SM+3/cY2RTCjtRdxGGiIMWoG9qh1 HiynYexOOA2rd4Nswiwuv3WZTHxSW3twznxsqb/+1ZoPjwclqT6xCoOiV5wLTsSakoCwjBhlLXV 9aR/8g217qrAvzUkF6M4Wjp4v0HH3WF0F/ExxiGJSNOAnW2hoD8EPtg== X-Gm-Gg: AZFdTZf2eACRjuIkAPDgLDk+WIPOZKKmofj0U8ygEXSqrVWfxjhodEyddtO/53n7ADu Rs47N5Efr3JG9VZS5geSSELRy+yVvP76N/8xH+drk691bKcPf+22bBkaeoAhzhTPdNC4WVz9XcM 564cZt3YvqAF0MLfMvcn7l2Ahx2K4mEXOrDu+k2Yud8XG6wa2RbJvUBe0/rb2iuv01uACgUtYpT W2Sqm65ghEkD+gMWsHqpT/pKSzCcsDwoKPGeXCM0B6TkjPzd6FdClaGN36miMTJBvo8KDchETc6 FWk4zIZEUu0Fcw2qefO/538kKSbeJOa8lkTuQEHjvcAGeU0/JA0jRKenEOc5OXUAx4Ns0sGuRFL lGxkTgPrJvSQez7fbP4omzE2+4ooD X-Received: by 2002:aa7:df12:0:b0:6b8:6805:8abe with SMTP id 4fb4d7f45d1cf-6ba37d183e8mr16779550a12.9.1796055901250; Mon, 30 Nov 2026 08:25:01 -0800 (PST) X-Received: by 2002:aa7:df12:0:b0:6b8:6805:8abe with SMTP id 4fb4d7f45d1cf-6ba37d183e8mr16779539a12.9.1796055900768; Mon, 30 Nov 2026 08:25:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1796055900; cv=none; d=google.com; s=arc-20260327; b=M/f8UwzlqDhU0fuggcH7z20V3+JAqAPhmBTfTAVJ5Ae2AKeFfzWsVmG9djhjBGLNL9 GVKAbXKQ8pYDR0uC5uvWlbStJuA2mRUeeTSjxEgn8rGjM1YDgusD5XrcDTQpLRwPrBsX rkOe7YTeJnl3Xenz7qOGuZSTm+ju4QSL7pZKyFI6mAL4IR2mYY7DwCIyMvhM2nnqCxbu PdiB6Fqn79CCQhfNFelYMNlqskvYG+yzBPAJfktPh+IA8rwWy7mW6wmuaOc6G1+rWmqE W4ms2AjaUhd5n5ivJnr/PUhQMmZ5+krofVv++NmuR7V+mNfXWgXAtusUO5GMgkH/i5Gy 3G4g== 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=ZbAwv6/WPqvrA4kvEBV4fNWocB5gtD4aEG5fZse15eI=; fh=CMILZ+goaghq6B4UpCDhf0EQp6kYD0LAlmOkUiVCOvs=; b=CGy2vaytJxeVZQ7eegvNOLGSI2RbRU4JQxMo+H3BlWYSI60415QU8VlJiReAV6QQQq elCtxb3IUXgLw7+gmy6an3ZuiQFCf2i6USqSOZ3c9CFvLKeSfM/kiQHrn/UKY3UXa2sz feLh5OLu8P50tuN6HlEu7JreTB6NCvZ1kRrYseh9buZN0aWedHaONXWTsx697iQ4VUdY Sd5RPrJ4USglhczpShH23iz6fUp5k9a33kxAVdFaFZ4r00YkODQQOweRm4kyetr3ZAwd DUM75dtNtkqfZTdhCXLtk+OFYIJWrq6pq6W06BKk6PmAUR8k3eqa7hbsfONSflSr4409 sQbA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=WbrGvBzi; 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 4fb4d7f45d1cf-6bb9f816089si6736297a12.138.2026.11.30.08.25.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 08:25:00 -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=WbrGvBzi; 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=ZbAwv6/WPqvrA4kvEBV4fNWocB5gtD4aEG5fZse15eI=; b=WbrGvBzi+Cmb k+pQwMXwqfsstBpveZDOLjhI8PMnz5eryJi/HjdiQivW1JIr6GMMadMViFdPMpbSGjJu/tHdCnhb3 rM+HIhLDYSzMi1kobJH3f9BLDQHnTVgZEvfuEEwD29s5u6dRoeEi/llIF24+ME0GZfiorYTHjr7MR 5wji/w3IFI7X7A3LqVsZslHngFvJGrm0eYWIlwgf3Ssrvl3oYeH6Yskpl2lHfHFMKzG0po/99Fo/R ODVZ7/XFu4iL0x6BEskIoLTENmWQPffL3HY5taZn/QZM65oByeKo385f6brBnXoIsPkgen1DeAHOy oLnJtEfwkq+Hsq+9Yxt8QA==; 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 1xY4BF-00Gm7s-16; Mon, 30 Nov 2026 17:24:51 +0100 From: Alexander Ivanov To: andrey.zhadchenko@virtuozzo.com Date: Mon, 30 Nov 2026 17:24:55 +0100 Message-ID: <20261130162456.1822406-7-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261130162456.1822406-1-alexander.ivanov@virtuozzo.com> References: <20261130162456.1822406-1-alexander.ivanov@virtuozzo.com> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.2 v2 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 bfbfe7b47c90..034810e51992 100644 --- a/drivers/md/dm-qcow2-map.c +++ b/drivers/md/dm-qcow2-map.c @@ -4717,12 +4717,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 eb3750284c00..5ecd501099c8 100644 --- a/drivers/md/dm-qcow2-target.c +++ b/drivers/md/dm-qcow2-target.c @@ -1032,6 +1032,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. @@ -1147,6 +1158,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; @@ -1158,8 +1170,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'; @@ -1244,7 +1263,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