From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (unknown [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 0235E80024 for ; Fri, 28 Aug 2026 17:05:36 +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 67SH4N2h011626; Fri, 28 Aug 2026 20:04:24 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 67SH4N2h011626 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="DyuM2z+o" Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 67SH3vre011547 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Fri, 28 Aug 2026 20:03:57 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 67SH3vre011547 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4955fd77c18so6698685e9.2 for ; Fri, 28 Aug 2026 10:03:57 -0700 (PDT) X-Gm-Message-State: AFuF++lkwST1ex1yDERUKM2xhoIF2BX9A1CQ1pVKDSu99qW+JjFZkoXP 5sDB2168t8Jd8PkAzd/3RUkhKYbqYGspAjnBnUfkXn766Q/7s4mOrbctVmFVNNK0hCU6VBSLgc2 +lzftUxE5nOqFjHB90ldPBpiWxDAT2RrCUiSmukhZnNjtoRSJFupY+g== X-Gm-Gg: AR+sD10DoWdd9sIRq2rX0u4OM0ZVh8pFKio/NZ8jQB9vu/flXUB0v+dJywNg+gqoHT3 Cu2l39HOwR/JBM7KOSyQTcrn290H+aQhaUOrZ0cGw1ikK7RFpydp5Siz+aMjrhKBve0vWtHgdUh /1NEl8zwBAo3HSdTaydPtGwcr1G2VNbcgdWxFqLyWyzXRSlMFe9jTpTA08dxAFl7dplDTSYMvfc bxFKWYegxqEuTQ6uzQ3+IIS5MnQVHFrN/xOJY/jlOst+QgA4PL3E31iGC1/yWkX3gsg7oB5mAJC cmk8veq4E9T1sjaaanfinHVmEh5d0ZhAj03wT/xUrG4bsIDP2b9a4Du0Q6ZszDzFUjCKKvjXcIf kyuhawGim2egOO8u2 X-Received: by 2002:a05:600c:1f8f:b0:499:b65d:1250 with SMTP id 5b1f17b1804b1-49b91c1fc4bmr90655795e9.2.1787936636707; Fri, 28 Aug 2026 10:03:56 -0700 (PDT) X-Received: by 2002:a05:600c:1f8f:b0:499:b65d:1250 with SMTP id 5b1f17b1804b1-49b91c1fc4bmr90655145e9.2.1787936636331; Fri, 28 Aug 2026 10:03:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1787936636; cv=none; d=google.com; s=arc-20260327; b=rX670HLQsuA3jOmosiSo+UddfOBkYQhIdQggIpAz3xSnhtf34oFpm56O3FLuiy4K3t 0pTZxj55oxSzHYyhRL9d5eZHXYgm5oOoouQz34Ijet6NotiBrIE8cqKFIkhtSgkFo6Dx zyV1ZnKfFmpN7/yKYWZrWcU1Hf58GqurHxl7e8fczyICCovlozAXpeEiwAjrsKbAl3O8 4AdreT8nmlU/085J30Qb9uxfURmqHq10L8a8Xgh1cofhGi/nBycJ0Lr88TV5D51ulXI/ RZIwgbr+jcDcTi4YNYxbxMNLx6cN2xWwBH5YClfoZ5WRaLj6TytUsYVq61zVqx2n1TGE /new== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=subject:in-reply-to:cc:to:from:message-id:date:dkim-signature; bh=0QgbNoWz4u6Uw6BZoIAePcPemnkHzQWuQXDxkmPXnLw=; fh=Vum9jOrhj7HN5ByxRUgrKjNRrylYGqSqAPC0VlAu4Lc=; b=NT/lHDsxh+xf+RIMw5nfsvT4P6OiQE+wSAt72i5ghbd580xY+Oayo8Xfn98ugfR0Fu FSw7hPl2wUtziYh1ZWA0gyWpQqBoBmc6wqBG/JajQtZmWh9W36MXcaoKUBi+UVnPA/Jf PRvQ8vKBXE/x2utdxBTpNt7/vhlTwhYriXeUZp+97t9zmWzEL6ZSMUBMC1Mgw1grDIbh ccBT3dOc2nnVkdCKzly+iXQNMZ8t9A6/Ze2CyOhG6jfGpoReZroVfMA3QQjV64f4XkWq /KhSYojYp1pHPaeEqx67c6MulyT0OwYXnmalL0RsoaxWw2IImuLo8/adsCecA1V5VgWv PCyA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=DyuM2z+o; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@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 5b1f17b1804b1-49b4e1c91ddsi115766425e9.21.2026.08.28.10.03.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2026 10:03:56 -0700 (PDT) Received-SPF: pass (google.com: domain of khorenko@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=DyuM2z+o; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@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=Subject:From:Message-Id:Date:Content-Type: MIME-Version; bh=0QgbNoWz4u6Uw6BZoIAePcPemnkHzQWuQXDxkmPXnLw=; b=DyuM2z+oi5j3 FHWnIhcq68rttGmlaAVKQhGqsTJAa4Qks8itHKlTciT7ba6Klmqp+RDS6xm4mHAwR/Q11TdfTdfaE MJCTPAdEHbU8qLmNyeSGrnLuAOidrQYdjhCYMDZvcizTeCdClhCg0AnYaAPrwe2w9auEv0Mjeb538 1vJrKal9tvHwvVZFBIrMoni/xeAvYBhOwWSrASPjYJiQYn329sQcF3gkKnzsPjOAcY3m0bJwglpD2 3b0Hc5ONfs9z/mU8tXfUZbqabaZ7fnTybX04GfZC28V+GJN7sXdxHf6fPpwTDCMzOrklcc6Thbknv v3cJ9OLgqOTHWzM2DlncVQ==; Received: from ch-demo-asa.virtuozzo.com ([130.117.225.8] helo=f0.sw.ru) by relay.virtuozzo.com with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wzzxO-008duR-0l; Fri, 28 Aug 2026 19:03:52 +0200 Received: from f0.sw.ru (localhost [127.0.0.1]) by f0.sw.ru (8.18.1/8.18.1/Debian-2) with ESMTP id 67SH3tKO1064174; Fri, 28 Aug 2026 19:03:55 +0200 Received: (from kostja@localhost) by f0.sw.ru (8.18.1/8.18.1/Submit) id 67SH3tt81064173; Fri, 28 Aug 2026 19:03:55 +0200 Date: Fri, 28 Aug 2026 19:03:55 +0200 Message-Id: <202608281703.67SH3tt81064173@f0.sw.ru> X-Authentication-Warning: f0.sw.ru: kostja set sender to khorenko@virtuozzo.com using -f From: Konstantin Khorenko To: Andrey Zhadchenko In-Reply-to: <20260827160619.303398-3-andrey.zhadchenko@virtuozzo.com> X-OZ-Fwd: true Cc: OpenVZ devel Subject: Re: [Devel] [PATCH RHEL10 COMMIT] drivers/md/dm-qcow2: fix revert_cluster_alloc() for ext_l2 case 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: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org The commit is pushed to "branch-rh10-6.12.0-211.39.1.16.x.vz10-ovz" and will appear at git@bitbucket.org:openvz/vzkernel.git after rh10-6.12.0-211.39.1.16.11.vz10 ------> commit 96e80433d537c82f2cfb27a3e2c335882d4e15a3 Author: Andrey Zhadchenko Date: Thu Aug 27 19:06:10 2026 +0300 drivers/md/dm-qcow2: fix revert_cluster_alloc() for ext_l2 case This function walks over all changed u64 values in md. With ext_l2 half of them holds subcluster description. Firstly it reverts these values to saved pe_page, which is fine, but then it tries to revert r1r2 changes. It makes no sense when the value is a subcluster description. Teach the function to skip subcluster descriptions: do it based on a new lx_level in struct wb_desc. Add new argument to prepare_l_entry_update() and set it there. The warning also could have tripped for ext_l2 entries, so drop it entirely. The function effectively reverts not only cluster alloc, so rename it to revert_l_entries_update() to mimic prepare_l_entry_update(). Feature: dm-qcow2: block device over QCOW2 files driver https://virtuozzo.atlassian.net/browse/VSTOR-139406 Signed-off-by: Andrey Zhadchenko Reviewed-by: Pavel Tikhomirov Reviewed-by: Vasileios Almpanis Reviewed-by: Konstantin Khorenko --- drivers/md/dm-qcow2-map.c | 28 ++++++++++++++++++---------- drivers/md/dm-qcow2-target.c | 2 +- drivers/md/dm-qcow2.h | 1 + 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c index 6ead06ef7b3f9..52dc68baa49be 100644 --- a/drivers/md/dm-qcow2-map.c +++ b/drivers/md/dm-qcow2-map.c @@ -1297,18 +1297,19 @@ static void do_md_page_read_complete(int ret, struct qcow2 *qcow2, } /* Be careful with dirty_or_writeback()/etc! Check races. */ -static void revert_clusters_alloc(struct qcow2 *qcow2, struct wb_desc *wbd) +static void revert_l_entries_update(struct qcow2 *qcow2, struct wb_desc *wbd) { struct qcow2_map_item r1, r2; struct page *pe_page; + bool skip_odd; u64 pos, old; int i, ret; + skip_odd = qcow2->ext_l2 && wbd->lx_level == L2_LEVEL; + lockdep_assert_held(&qcow2->md_pages_lock); for_each_set_bit(i, wbd->changed_indexes, LX_INDEXES_PER_PAGE) { pos = get_u64_from_be_page(wbd->md->page, i); - WARN_ON_ONCE(!(pos & ~LX_REFCOUNT_EXACTLY_ONE) || - !(pos & LX_REFCOUNT_EXACTLY_ONE)); /* Here we restore prealloced and compressed clu mappings */ pe_page = wbd->pe_page; @@ -1321,6 +1322,9 @@ static void revert_clusters_alloc(struct qcow2 *qcow2, struct wb_desc *wbd) } set_u64_to_be_page(wbd->md->page, i, 0); + if (skip_odd && (i & 1)) + continue; /* pos contains ext_l2 part of L2 entry */ + spin_unlock(&qcow2->md_pages_lock); pos &= ~LX_REFCOUNT_EXACTLY_ONE; @@ -1369,7 +1373,7 @@ static void complete_wbd(struct qcow2 *qcow2, struct wb_desc *wbd) unsigned long flags; spin_lock_irqsave(&qcow2->md_pages_lock, flags); - revert_clusters_alloc(qcow2, wbd); + revert_l_entries_update(qcow2, wbd); clear_writeback_status(qcow2, wbd->md, wbd->ret, &wait_list, &end_list); spin_unlock_irqrestore(&qcow2->md_pages_lock, flags); @@ -2433,7 +2437,7 @@ static loff_t allocate_cluster(struct qcow2 *qcow2, struct qio *qio, #define LU_IGN_CHANGED_IND (1 << 3) static int prepare_l_entry_update(struct qcow2 *qcow2, struct qio *qio, struct md_page *md, u32 index_in_page, - u64 *pval, u32 arg_mask) + u64 *pval, u32 arg_mask, u8 lx_level) { bool wants_pe_page = (arg_mask & LU_WANTS_PE_PAGE); struct wb_desc *new_wbd = NULL; @@ -2453,6 +2457,7 @@ static int prepare_l_entry_update(struct qcow2 *qcow2, struct qio *qio, if (!new_wbd) return -ENOMEM; new_wbd->md = md; + new_wbd->lx_level = lx_level; } else if (wants_pe_page && !md->wbd->pe_page) { pe_page = alloc_page(GFP_NOIO|__GFP_ZERO); if (!pe_page) @@ -2515,7 +2520,8 @@ static int prepare_l1l2_allocation(struct qcow2 *qcow2, struct qio *qio, /* Allocate cluster for L2 entries, and prepare L1 update */ ret = prepare_l_entry_update(qcow2, qio, map->l1.md, map->l1.index_in_page, &val, - LU_SET_ONE_MASK|LU_WANTS_ALLOC); + LU_SET_ONE_MASK | LU_WANTS_ALLOC, + L1_LEVEL); if (ret <= 0) return ret; @@ -2541,7 +2547,8 @@ static int prepare_l1l2_allocation(struct qcow2 *qcow2, struct qio *qio, ret = prepare_l_entry_update(qcow2, qio, map->l2.md, map->l2.index_in_page, - &map->data_clu_pos, arg_mask); + &map->data_clu_pos, arg_mask, + L2_LEVEL); if (ret <= 0) return ret; @@ -2562,7 +2569,7 @@ static int prepare_l1l2_allocation(struct qcow2 *qcow2, struct qio *qio, return prepare_l_entry_update(qcow2, qio, map->l2.md, map->l2.index_in_page + 1, - &val, arg_mask); + &val, arg_mask, L2_LEVEL); } /* @@ -3979,7 +3986,7 @@ static void process_cow_indexes_write(struct qcow2 *qcow2, ret = prepare_l_entry_update(qcow2, qio, lx_md, ext->lx_index_in_page, &ext->allocated_clu_pos, - arg_mask); + arg_mask, ext->cow_level); if (ret < 0) { qio->bi_status = errno_to_blk_status(ret); qio_endio(qio); @@ -3990,7 +3997,8 @@ static void process_cow_indexes_write(struct qcow2 *qcow2, arg_mask &= ~LU_SET_ONE_MASK; ret = prepare_l_entry_update(qcow2, qio, lx_md, ext->lx_index_in_page + 1, - &ext->new_ext_l2, arg_mask); + &ext->new_ext_l2, arg_mask, + L2_LEVEL); WARN_ON_ONCE(ret < 0); } diff --git a/drivers/md/dm-qcow2-target.c b/drivers/md/dm-qcow2-target.c index 2877de6f11c12..be09615eb8e2e 100644 --- a/drivers/md/dm-qcow2-target.c +++ b/drivers/md/dm-qcow2-target.c @@ -174,7 +174,7 @@ void qcow2_flush_deferred_activity(struct qcow2_target *tgt, struct qcow2 *qcow2 int i; /* - * We need second iteration, since revert_clusters_alloc() + * We need second iteration, since revert_l_entries_update() * may start timer again after failed wb. */ for (i = 0; i < 2; i++) { diff --git a/drivers/md/dm-qcow2.h b/drivers/md/dm-qcow2.h index 86f0688e7345a..aa3487007523f 100644 --- a/drivers/md/dm-qcow2.h +++ b/drivers/md/dm-qcow2.h @@ -118,6 +118,7 @@ struct wb_desc { struct list_head dependent_list; int nr_submitted; bool completed; + u8 lx_level; int ret; }; _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel