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 03B0D80E93 for ; Wed, 28 Oct 2026 15:08:27 +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 69SF7G8d021150; Wed, 28 Oct 2026 18:07:17 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69SF7G8d021150 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="LwkKEuCQ" Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 69SF6rSU021073 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Wed, 28 Oct 2026 18:06:53 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69SF6rSU021073 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-48e0389d6f9so670286f8f.1 for ; Wed, 28 Oct 2026 08:06:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBz76W2QBCOl/8ii9X4JfGNMY+/JbFA/lHWJpiNHTHeBAeiRWRo0OMyk8tSH+nch15ITUWtfsg==@openvz.org X-Gm-Message-State: AFq9FYJIjm7ImGojsYjife/QhY7XyncfY12WO/wnLO41wvTLKFTaSvWe IHN0KbM9vVS7+y5t6SKAuJ41lRfHc5u6otxYwlsRAdzdif7bZaKjqfmOfUPlobVPfkv+xYl/zES yiJZj0LKlHfASWoBBGgzjKphSgpzYP3MCcPsB+llXBx0WKd3WnM+sXg== X-Gm-Gg: AYBFou3G1U1NFgx75Wcng+UqBapm8EOtVxxr02HidSKylp+D6DVwIUQUWuROfwPsrN/ qO7JJ9RRVwkY9r155gsAYw4qTCaEmIbuN4hfwYC9uS2LmGlmoETclE3D8Hz/QGu5ciuUJLxBe93 lbPMnM8p57W+QynRPRoaqPtDxYibU2A9xhFqggtVwjkoZ/anwiC7OVrnCZzcCMd0CL7L1wLvpEi EspR3e2IimWqRUbqpUy5KS/g50XEsaw3jgsc1tNVTXP1ccbQvPDpkb3AD0Mc6wGmPlDr4qlMHNi UpdkFduIQBQq5yFYE6377YqlSbsZLlppVGoi8NHnr41domzqmvT/ZB0ouptU61sPHX4xM531Grz WahB25Y210sKtCsIWnKO4YLev+Eno X-Received: by 2002:a5d:4572:0:b0:48b:11df:c496 with SMTP id ffacd0b85a97d-48e5d5bf34bmr4676839f8f.28.1793200013290; Wed, 28 Oct 2026 08:06:53 -0700 (PDT) X-Received: by 2002:a5d:4572:0:b0:48b:11df:c496 with SMTP id ffacd0b85a97d-48e5d5bf34bmr4676778f8f.28.1793200012678; Wed, 28 Oct 2026 08:06:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1793200012; cv=none; d=google.com; s=arc-20260327; b=MKd01qX0jDupe7bqqyOTXb3LGKyOldonH4L8BHrSNVmBJ8fzBeFAuW9ImTKqUwhNh9 67oQm3oYBGrAuWn7f7RNPXIM5Lyd9bsLpzSdkKvMa86NmpzzWhFBb0LRIxHia4CqgtHf 41cTu/6rk0sFUPiLx/XSY0qaEBwHxMwXe0XIUGZEquF/jfoIcmXBmQUt6TUk8c9rU/Nz 20fcn2Q1v4eJfXMnXbU1SCRNR5+KRlSYN4hUz3qAUwCMOJhfZtqwtoPFLU/dIxAtWciw 5HfqvUtUtzBMfkqnueAlVdlUf812wHLD8i9v2KizBCd0KYdE71nUKGB7UWBV4Egrq6Pw 83iA== 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=yHTmY8NZ37GPbZGHSWisLz4GXBg2RG+6Hwsht8lfxTM=; fh=CMILZ+goaghq6B4UpCDhf0EQp6kYD0LAlmOkUiVCOvs=; b=ru/gRh6c6hCBFJeqvtD/Xmd22hzumc7yPorZDnQlU07auLKYq9Ow2YbuQOxAG+vq6M ULe8hWJY6PAKNh/lQqAjyAguQD2wtOE2siiWT/MPq9fzWjN8cGg6pCKaNYf3yHe8gDsU a8pxUU7uJv9a31aItq3xtM4DgtK35Fzt2jsUeD4h8R2X1df+S9Ys/wPWtNm/hmiT8wP2 RzuKn5aj/t7rvgXq1QuXlllum8xOcvVbyw/WH4wwjNQRxWbFsav9Jkkw/nFI2lze2zkT 5Nw8m3bRN2SOTo7ccMzIh0wOcjCgTlXr1VTFET8DXo8TzwIBER2rZ7oh925z02QUhpvF g2NQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=LwkKEuCQ; 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 ffacd0b85a97d-48e3ed2defdsi26314083f8f.475.2026.10.28.08.06.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2026 08:06:52 -0700 (PDT) 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=LwkKEuCQ; 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=yHTmY8NZ37GPbZGHSWisLz4GXBg2RG+6Hwsht8lfxTM=; b=LwkKEuCQbSM9 oHRYC3nOWc34q+KpDbl4JTt7p6gTMH3ycakRcvdThhHtnIrU+Vu8PBUtuAAsm8nY7gMwjbZVkovQn /NmxCtToIeZdqzGs9+EomDnuC0zpHhE6WF6dlYnpLVFdUbyOETdx26MobNYQrlMWXxPCLtQNarWJz jGoAXgraXmXZ0w/wumbhrqNBPServWLiC6SCX14szFV8Px/ejR2CWPKZ1tZB4kZyYHkJ8U4KuxLJ0 UzaXNud1D26nViTZQV6YkabAeND7C19DIEnix044GnzdDjXw0yNbCVVuRykYRh/RV4olA+NnRC4Zi 2E0cPJ0gVj5VxHlcnoY+zw==; 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 1xM5B4-00AtLl-0D; Wed, 28 Oct 2026 16:06:51 +0100 From: Alexander Ivanov To: andrey.zhadchenko@virtuozzo.com Date: Wed, 28 Oct 2026 16:06:43 +0100 Message-ID: <20261028150645.3222391-9-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261028150645.3222391-1-alexander.ivanov@virtuozzo.com> References: <20261028150645.3222391-1-alexander.ivanov@virtuozzo.com> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 v9 08/10] dm-qcow2: flag the image for check if reftable relocation fails late 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 Once relocate_refcount_table() has issued the header write pointing to the new reftable, any failure returns -EIO. The header on disk may already point to the new reftable even if its own write fails: a short write is reported as -ENODATA, and the old reftable position is restored only in the cached header page, which a v2 image never rewrites on suspend. The new reftable on disk may then be unfilled or miss the new refblocks, while refcounts of the new and old reftable clusters may not be updated. Refcounts no longer match the header, but nothing reports that, so the device can be resumed and the image reopened as if it were consistent. Set md_writeback_error on these paths, so wants_check reports the image and resume is refused until it is checked, and log the failure. https://virtuozzo.atlassian.net/browse/VSTOR-148171 Feature: dm-qcow2: block device over QCOW2 files driver Signed-off-by: Alexander Ivanov --- drivers/md/dm-qcow2-map.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c index f6e66799bf27..185243584e0c 100644 --- a/drivers/md/dm-qcow2-map.c +++ b/drivers/md/dm-qcow2-map.c @@ -2351,6 +2351,8 @@ static int relocate_refcount_table(struct qcow2 *qcow2, struct qio **qio) if (ret) { /* Restore old R1 */ set_reftable_in_raw_hdr(md0->page, old_pos, old_clus); + QC_ERR(qcow2->tgt->ti, "failed to relocate refcount table"); + qcow2->tgt->md_writeback_error = true; goto err_free_r2_pages; } @@ -2376,17 +2378,17 @@ static int relocate_refcount_table(struct qcow2 *qcow2, struct qio **qio) } spin_unlock_irq(&qcow2->md_pages_lock); if (i != nr_pages) - return -EIO; + goto err_hdr_written; /* Connect new R2 to new R1 */ for (i = end; i < r2_end; i += clu_size) { if (calc_refcounters_map(qcow2, i, &r1, &r2) < 0) { WARN_ON_ONCE(1); - return -EIO; + goto err_hdr_written; } ret = handle_md_page(qcow2, r1.page_id, NULL, &md); if (WARN_ON_ONCE(ret <= 0)) - return -EIO; + goto err_hdr_written; spin_lock_irq(&qcow2->md_pages_lock); set_u64_to_be_page(md->page, r1.index_in_page, i); qcow2_md_make_dirty(qcow2, md, true); @@ -2397,7 +2399,7 @@ static int relocate_refcount_table(struct qcow2 *qcow2, struct qio **qio) for (i = pos; i < r2_end; i += clu_size) { ret = qcow2_handle_r1r2_maps(qcow2, i, NULL, &r1, &r2, false); if (WARN_ON_ONCE(ret <= 0)) - return -EIO; + goto err_hdr_written; mark_cluster_used(qcow2, r2.md, r2.index_in_page); } @@ -2405,12 +2407,16 @@ static int relocate_refcount_table(struct qcow2 *qcow2, struct qio **qio) for (i = old_pos; i < old_end; i += clu_size) { ret = qcow2_handle_r1r2_maps(qcow2, i, NULL, &r1, &r2, false); if (WARN_ON_ONCE(ret <= 0)) - return -EIO; + goto err_hdr_written; mark_cluster_unused(qcow2, r2.md, r2.index_in_page, i); } return 1; +err_hdr_written: + QC_ERR(qcow2->tgt->ti, "failed to relocate refcount table"); + qcow2->tgt->md_writeback_error = true; + return -EIO; err_free_r2_pages: while (i > pos + (u64)old_clus * clu_size) { i -= PAGE_SIZE; -- 2.53.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel