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 384BE80027 for ; Thu, 19 Nov 2026 01:11:28 +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 6AJ199gY031323; Thu, 19 Nov 2026 04:09:10 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AJ199gY031323 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=default; t=1795050552; bh=eEK8R6PeKN5+NT1wlDDpaX3y/n767VSAengYV6AQVWc=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe; b=m9RbIl7Q3kxEAGb4s8+8D2OyiveiZm7ELiDQZJNrOxZoWm/4oaCjSvMM2fZnagUTU z69c65pRkinVeTk70dpnavkg/pSAb56o4Y6khyOy6kKxfZiouxj2LOcXrxIsJ2/Ui2 BbmSDy0KtnnWFmby4eXaSRY1PJeVfle94lbR7tXGV0iYn3JGwW4OpjEb7FPC+WZlAO 6jXy5rx1dDMfBR7xZRiDNrTfrFbgbBWDF6JX/pVvC74veDd/hiHLlYOv7vf3BuMSyB Bl/no2QVPH7mxx2v34Ym+Cwui63j93Ekp4KLGvn0hexcyBMKl06p2JYBUibo8D888h 8fzG0c2/WuX4w== Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AJ1914X031292 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Thu, 19 Nov 2026 04:09:01 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AJ1914X031292 Authentication-Results: mail.openvz.org; dkim=pass (2048-bit key) header.d=openvz.org header.i=@openvz.org header.b="hsFYgKbu" Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4ba078abd78so11936665e9.1 for ; Wed, 18 Nov 2026 17:09:01 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErHNJwqdJyQos6H1oI9/+LmREnUW07zqZnvewom/MJb7vAqDUWdGow1WRMYlieayiCbAXtNW5Q==@openvz.org X-Gm-Message-State: APuU4Z8GFa5uVe9HbYXPskUmLvdYW76ps4Npy5XNSvtvy60Ey4Ngbydi 0oD9nO/W+fFxEGMzX31XjCakDi9NhvKfyOlRR3O6YM2Zy4xCV4nWeMafgMp+TmZNniRxpmqJxXi ZyWbJI6L3CQ4yzoDk3/cbz41BVMKQUoVixpT44l/iumYrID4gFxWa1w== X-Gm-Gg: AYBFou0ntMNlJgM8FRIN4apeHJtLgHdE/Bcot6QZcwVNg1QrHxv9Oqa02dVwFAx/S6s JE4mFCSy70P7rMOWio4YlZFEqfFZDEh992FhoXQB5gMTfJ3BNzYc8s0BDi1xKCEZJoWG1Hi57o5 UzpP4bgzTBAnTo935q71u52Zs1jMYNTKNZeJqD2WzTStDSvMasYCFKSvYZpW57tsFZZaNA/qfxo U3D0RNrBbcVSZxk4MJ9mngPDBPxmljZqoXWqgcYW0vGTa63oDW8LWURzurIEmrcKzDsMeOe5IC/ kGBD1XPZqQ== X-Received: by 2002:a05:600c:3b17:b0:4bb:5df4:685b with SMTP id 5b1f17b1804b1-4bb7da36071mr89696815e9.23.1795050541234; Wed, 18 Nov 2026 17:09:01 -0800 (PST) X-Received: by 2002:a05:600c:3b17:b0:4bb:5df4:685b with SMTP id 5b1f17b1804b1-4bb7da36071mr89696655e9.23.1795050540945; Wed, 18 Nov 2026 17:09:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1795050540; cv=none; d=google.com; s=arc-20260327; b=jS8JesvOQd3VjuqeWh8zsrIwTPoQ7Tp9whYLwIoEycM02SGYrI2RkweckYOyo+1xeK 79vZgfsOESLeS+GObSb1bqHLJSlKPMj7o3l1BrCH3I7v2N7tI3Wc8NtadB58QhSkIWm9 Mq7Vez4wyZB6+VTIWW0PVpvILBS3+Iu+s6AI0dBhbGhcnY5hOjF9Mu1utHgqSiMCdJaJ 3Q9vjcZ6NcY/LytstY3xyOy5TODMUZKsOWFLrwAvyPImfDZnjG6P29TELbvkOh3vYlly D3Cw2sujrhNA8odoeKAqVFhDPgz38NI1MR0hIWn8FRn6uDREJVAwzBAEvQ12APgvsBTQ Yw5g== 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=J6prTBpyKO8ATN/VS33Ky1nZysrkYbNJf6LZdqKQ9nw=; fh=BsCuSUB6yHWTqXazn6jRsg/Yi0KVNERQPOkUVY4uFJc=; b=FRXxn6QuRLfP26DwRMlfoqgJ8QXV8uv3mppGWaGYZ6AO08e1BZCVp/2Oltz+qLOxW/ NxQcyTvsrH6u5cAU5oftAT3uaUZ8coEC/aAvbFV8QR8AHAWs4TOqK8YceBIbL5aW4h+c XoZa4SqK35ipQuZ7+vH326adW5FWQ44DiJLrVa3SitvLqtWemKG2H0uQvjXi5ZrFDmAZ EOo82VIZgBUgpxozeAzXUwSrDOhVdZYmkY3WRw790sqn2tNY7UInGmsgyf4tiejW8R6M u0HSy7MFMU/WDDS/+6AjFg7S/QjI2yjqMT23DFTyjGfcpIhW8KKeabD5IDdYEFKM2tkv CMmQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=hsFYgKbu; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:8c09:3cc3:6efa:ac1f as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-4bb827596b4sor1793695e9.16.2026.11.18.17.09.00 for (Google Transport Security); Wed, 18 Nov 2026 17:09:00 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:8c09:3cc3:6efa:ac1f as permitted sender) client-ip=2a06:5b06:b600:300:8c09:3cc3:6efa:ac1f; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=hsFYgKbu; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:8c09:3cc3:6efa:ac1f as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=google; t=1795050540; x=1795655340; darn=openvz.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=J6prTBpyKO8ATN/VS33Ky1nZysrkYbNJf6LZdqKQ9nw=; b=hsFYgKbu7Gw6vVO5Jwz+1qVmX97HMang+27L63Lh7w9feyLX6lJj/WQotOIFgiW2gx ZsPTjrA0th95Qr66vgVR1Ovr5NGCpFl7uFwuSWCwCz1MhcRhOYsu34A59iWOKFYi+Wx1 eFZdrnAqtkB+jeOrBbPrVKc03woGCZep0XVLH+VQs2/OtMsZmVYMB2BwfOWFMQRBPrW+ xnHZPt8/8QLvkq7aoZJ37FAyPQ/j69aJ3zgFb3WIY2lorXInHcC6tYDns45nasUzhW1M nsstN80O4d5knifXncj7Ms/lTZdoMpiXCGMxTcreictD4kMb7NTDV1l/ajGXF2xesXXI 7apg== X-Forwarded-Encrypted: i=1; AL+hErELSCRBA1nsKqjdC42Nkxr80TJiTNDBW3N5I5NWAn0AvFuOpceGzbSByMgqNXTUTXXQYfSagg==@openvz.org X-Received: by 2002:a05:600c:34d2:b0:4a1:6992:f861 with SMTP id 5b1f17b1804b1-4bb7d6d1f21mr85694805e9.1.1795050540538; Wed, 18 Nov 2026 17:09:00 -0800 (PST) Received: from artemis.sw.ru ([2a06:5b06:b600:300:8c09:3cc3:6efa:ac1f]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4a65560b2a1sm7266442f8f.32.2026.11.18.17.08.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2026 17:09:00 -0800 (PST) From: "Denis V. Lunev" To: alexander.ivanov@virtuozzo.com, vasileios.almpanis@virtuozzo.com Date: Thu, 19 Nov 2026 02:08:52 +0100 Message-ID: <20261119010854.4107497-3-den@openvz.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261119010854.4107497-1-den@openvz.org> References: <20261119010854.4107497-1-den@openvz.org> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.2 2/4] dm-qcow2: fix ext_l2 subclusters mapped to cluster 0 after a write error 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 From: Denis V. Lunev prepare_l_entry_update() saves the current value of an index into wbd->pe_page on every update that asks for it, and the revert of a failed writeback restores what was saved. The subcluster bitmap of an extended L2 entry is updated with LU_IGN_CHANGED_IND, so it changes once per write that joins the writeback, and a second write to another subcluster of the same cluster saves the bitmap with the first write's bits already set. A failed writeback then restores those bits. If the cluster was allocated in this writeback, the revert clears the cluster offset of the entry but keeps the bits. qio_is_fully_alloced() trusts the bitmap alone on ext_l2 images, so later I/O to those subclusters goes to cluster 0, where the image header lives: a write overwrites it and a read returns its bytes. If the cluster was allocated before, the subclusters of a write that failed stay marked allocated. Save the old value only on the first change of an index in a writeback. https://virtuozzo.atlassian.net/browse/VSTOR-154310 Fixes: 222b6f1291c1 ("dm-qcow2: Introduce driver to create block devices over QCOW2 files") Feature: dm-qcow2: block device over QCOW2 files driver Signed-off-by: Denis V. Lunev --- drivers/md/dm-qcow2-map.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c index ea4dbd949897..d1ec79189f81 100644 --- a/drivers/md/dm-qcow2-map.c +++ b/drivers/md/dm-qcow2-map.c @@ -2666,6 +2666,7 @@ static int prepare_l_entry_update(struct qcow2 *qcow2, struct qio *qio, struct wb_desc *new_wbd = NULL; struct page *pe_page = NULL; u64 old_val, val = *pval; + bool first; /* parse_metadata()->delay_if_writeback() delays them */ if (WARN_ON_ONCE(READ_ONCE(md->status) & MD_WRITEBACK)) @@ -2705,15 +2706,15 @@ static int prepare_l_entry_update(struct qcow2 *qcow2, struct qio *qio, md->wbd = new_wbd; else WARN_ON_ONCE(new_wbd); + first = !test_and_set_bit(index_in_page, md->wbd->changed_indexes); if (!(arg_mask & LU_IGN_CHANGED_IND)) - WARN_ON_ONCE(test_bit(index_in_page, md->wbd->changed_indexes)); - set_bit(index_in_page, md->wbd->changed_indexes); + WARN_ON_ONCE(!first); if (wants_pe_page && !md->wbd->pe_page) md->wbd->pe_page = pe_page; else WARN_ON_ONCE(pe_page); - if (wants_pe_page) { + if (wants_pe_page && first) { old_val = get_u64_from_be_page(md->page, index_in_page); set_u64_to_be_page(md->wbd->pe_page, index_in_page, old_val); } -- 2.55.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel