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 1B9778002A for ; Tue, 24 Nov 2026 12:10: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 6AOC9Dcj019945; Tue, 24 Nov 2026 15:09:14 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AOC9Dcj019945 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="NihMCSwy" Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AOC9CI9019939 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 24 Nov 2026 15:09:12 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AOC9CI9019939 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-c40bbd26f74so339892466b.0 for ; Tue, 24 Nov 2026 04:09:12 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErFqMnRSpiNUiOGn9ZaD9Bl+3xY+6bwrmDgZbFnCXXcC9N1ieW7G2cKKaDGbjxfQxDPthrGnHA==@openvz.org X-Gm-Message-State: APuU4Z8SlPvjCFuIFSuSHdfJweic+66JLnbjiR/SXuLarU4q9y76/cZi V4JsF5PQ0Ts4rqFa0bA9z6falQ6XGDg/VDwxomb1rPvXLAS6Y+yXNOykVQuERgvsG9EsJbvLpPC QJ0wZ0x47BncY/2/FLTQBQN8hr3Cmrsu5X5wQD1TejfPf7gZQEnaXOg== X-Gm-Gg: AZFdTZc9xzjgIWgK81g8bZ4C+QMlsSiuIvuXJInFJwul9WghMqWR7+CKSISZmKNetHG VGabe42W0F/YeGsofoNwgKLqygU0/Ur3Cwc0vvd/mx8+DORyzETfZp5UFuQQAYEziWsMXS9K1aa ZMUjgNVteZW+PlYoHj/GLlnlmrhv+cIdfM7qxVvVz8ketHiJhBWQlGMDNgFwVKrJUqrlBTo0TSR AR5oF1KZsUKe5hWHYvwKyzU70z16vlG1wRt8S54BOIBA9ozmMfOCKfUTHw+pltelx2fhjjozRqD pJyD6eatCXA2BbC1fTy1fizltOAJMw04i8azPGdZpV004FIoj3IMdQFk+qdzn010Ahx8E31yLRV ZjV9J7yB7fMTK74YH5g== X-Received: by 2002:a17:906:b758:b0:c2d:bd87:7fa7 with SMTP id a640c23a62f3a-c513ab0c35fmr839384466b.24.1795522152074; Tue, 24 Nov 2026 04:09:12 -0800 (PST) X-Received: by 2002:a17:906:b758:b0:c2d:bd87:7fa7 with SMTP id a640c23a62f3a-c513ab0c35fmr839383066b.24.1795522151573; Tue, 24 Nov 2026 04:09:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1795522151; cv=none; d=google.com; s=arc-20260327; b=pEfftMbFU2ardeny8G5dZhNyxJK/EqJZKbI209Jc8ck/XLDN8/cxsM7YfLHbUGbnRi VsoJNAPADnI9PtJhUNLvowpjNGW+T5aOsF9XVmLdGapBqfRUGfTdNAYPEz6Amng+PdC6 9yRXz1yXrF5PWnsh7qA22IF+7BeIT2lk8Am83B2NaKZzo+ibLEvxIaTJ4nMmwOBcdL4/ lwVrMsA7cZDyhp7bTtPfzN534wXQFrEd9iZn5mNmVGDc8yuBaVgQS8WV791hdDux/h0c NElihHXb70wavjdSLt9i6+nZG1zfgId1DDLEC+2o+JHsrTtzn3QCpjPAkzN/DUyvPeQL HiJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=message-id:date:references:in-reply-to:cc:to:from:subject :content-transfer-encoding:mime-version:dkim-signature; bh=cvYB8aUQFHPtHnF50Zofk8H+IXbp8Gg86MtziAQpDgQ=; fh=R8Ij1tcsVJY6TTUifPlSxlHAYVrwxb1uCKcqBJJHxVI=; b=AfhaCD0VKE4gcm/rU50jzgRpQqnKpjjF8ouT9uAB/KvDSrUs4ssV/Ksf2TtzVkf2C8 P3w1SZ6f67zi4x/It4Vxv4mUrRRoYAm3tCiZ44Q1tUsTRod/vFyYx4UTxzujLwTWyPet XQks3E30dr3jDfDwy+dm4XjuDATA5lxrUSYdaKQaEiYXHV2PvGTAX5fRjf7EyM2nfUMu MQP5NlKs4Cm3FmwMLXVngaczCvt0mjU1hwrs2OY9d/Yo8YBzsLzPvCDLc3D1oV/oHeBW efIE5DP+30OfMWV2EfTbl9uQ47yt/vBFEJvpX7nD2Jmcuwa5iXEEBDSltS2N9qlzF6iz f81A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=NihMCSwy; 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 a640c23a62f3a-c513afe3a04si927118066b.60.2026.11.24.04.09.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Nov 2026 04:09:11 -0800 (PST) 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=NihMCSwy; 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=Message-Id:Date:From:Subject:Content-Type: MIME-Version; bh=cvYB8aUQFHPtHnF50Zofk8H+IXbp8Gg86MtziAQpDgQ=; b=NihMCSwyctxe zlfADiZsiwMHbwcytvJXRPo/AB7Qhfn4FXwiECxI4Nmxosm71sRnUqgyvpqEO+idmQiDAxOQRA998 jPLYbFWuV8GUJOEnmzAJ4M8damj9nl8X9Leq7Az3mmaVNpK/Hgxs5dc3mPdia/DUwjHbadn6cQpm9 ZkIAX1eFmPeNVhfXx3sbUGoREpH6M7Z8Rt+GMCdJCE23mmdLxgIIcn9J0IFOOSP/01chKGsIx5fKd kQfytH+s//mwBnzeW/W93yZRIZUDGAQPltiXhrxOGVQLuvAk/cotxuP8qHGgNhCvYZpvH2YMfy1F4 Q7SVjwdX5nkIpxg542wneA==; Received: from ch-demo-asa.virtuozzo.com ([130.117.225.8] helo=f0.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xVpKX-00GvVW-04; Tue, 24 Nov 2026 13:09:01 +0100 MIME-Version: 1.0 From: Konstantin Khorenko To: "Denis V. Lunev" In-Reply-To: <20261123191317.199611-1-den@openvz.org> References: <20261123191317.199611-1-den@openvz.org> Date: Tue, 24 Nov 2026 13:08:20 +0100 Message-Id: <179552210098.10044.15846686166662724394.b4-review@b4> X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3594; i=khorenko@virtuozzo.com; h=from:subject:message-id; bh=yj8X+nntECmcxl9UqpvPiFqhmOhCg+c7oCSQJm8VYcQ=; b=owEBbQKS/ZANAwAKAVGWCkf5YVwqAcsmYgBrBX41g696yiXNahqcxArfSb15vn8X7sUHlErM1 yrTYq3lg3uJAjMEAAEKAB0WIQRWD23IPcXT0GO9CCxRlgpH+WFcKgUCawV+NQAKCRBRlgpH+WFc KrOzEACgVG9IxeeubTXolRi7O+WTAAmKoV4frUXb3czgR/4IiF7LhuH8Hl8+Oh0xCviEtGBXj0c ULZz9bdo4cDO09bNyARbKUu1/dfncfb4K6ZpzAPWLkIAwkrJYSKy0n+v1UpefirQRL05ZbzM8BH rIN1oNmfmlXscbRXDFAYZjnPfBoQgR/4QIrZs1rYFy4zV9l3vGCRrLKW5ZOZXwk+730CxgJd4Fu jISEBIznRVW5CkOCk5i1ZvGftK5ZQrDCw1AK5dp4dPBgPuwym0kLS1TqzJo9pnWjpdlPehkYLQH 17hCWwGTHtZRT7za0A+tmmQMonrMC6e6krkXGoBu/rHVQ7SVi+HOGTA2wkk7VJb1qIkktNuF8YS gKNi7zrjFYpAuT2yEv1efgSd1pg5QKzSFcREQ8SdEZ2ZUZSCynBdaGPSH5qtFN2E3SE5nbkMc7M nbzWRQ6UysEL+0fIZSogOJxWJkI38St5pYKz7/Z4xikUyreJW1B+xi5v5TxxUstHB6cBEa6ciQi +5C2lBh70vjSRC8d9Mjqs/D7iyhLPCWy6gV0OyutojeXpmhPt16WaSQpYtsU6yys+ZLCmtoLD7g VhVc1MrW/hFlpKseoU7y8Xe/cz3rfhSvEE2Rys2bjpUQuNSluposeUreimviIN0lF/PvzMT+iUw uJ0SgEgnzPq42xw== X-Developer-Key: i=khorenko@virtuozzo.com; a=openpgp; fpr=560F6DC83DC5D3D063BD082C51960A47F9615C2A X-OZ-Fwd: true Cc: devel@openvz.org Subject: Re: [Devel] [PATCH hci-8.2] dm-qcow2: fix stale host data showing in a zero cluster after a write 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 I won't apply this version, please send v2 with the changes below. On Mon, 23 Nov 2026 20:13:17 +0100, Denis V. Lunev wrote: > dm-qcow2: fix stale host data showing in a zero cluster after a write - Cover an unallocated subcluster of an allocated cluster too, when there is no backing image or the write is past its end: it shows the same stale data. - Share one border-mask helper with qio_border_is_inside_unmapped_unit() instead of a third copy of the border test. - Keep the unchanged new_ext_l2 and calc_cow_mask() lines as they were. - Commit message: drop the sentence that retells the rename, say why cow_in_place is needed besides only_set_ext_l2, reword "whose other border". The zero unit part is right: the zero slices come from the map with no disk read, the cluster is written in place, and on a non-extended image the L2 entry is rewritten only after the data is on disk. > - qio_border_is_inside_unmapped_unit(qcow2, *qio, map) && > - maybe_mapped_in_lower_delta(qcow2, *qio)) { > + ((qio_border_is_inside_unmapped_unit(qcow2, *qio, map) && > + maybe_mapped_in_lower_delta(qcow2, *qio)) || > + qio_border_is_inside_zero_unit(qcow2, *qio, map))) { A subcluster with neither the alloc nor the zero bit set, in an allocated cluster, can keep old host data as well: qemu allocates a cluster for a subcluster write, copies only that subcluster, and may reuse a freed cluster for it. Without a backing image maybe_mapped_in_lower_delta() is false and the zero mask is 0, so a 4K write into such a subcluster goes to prepare_l1l2_allocation() and the rest of the subcluster reads back the old data instead of zeroes. qemu copies this subcluster type whole on a partial write, like a zero one. The sliced path already zero-fills an unmapped slice when there is no lower image, so taking an allocated cluster here as well should be enough. > +/* Zero subclusters with a border of @qio inside, which keep host blocks */ > +static u32 qio_border_zero_subclus_mask(struct qcow2 *qcow2, struct qio *qio, > + struct qcow2_map *map) This repeats the border test of qio_border_is_inside_unmapped_unit() (and of calc_cow_mask()): qio_subclu_indexes(), then SUBCLU_OFF() and a bit test for each end; only the mask differs. One helper that takes the mask would serve both, and the case above becomes a mask change. > + ext->new_ext_l2 = mask | map->subclus_mask; > + ext->only_set_ext_l2 = ext->cow_in_place; > + ext->cow_mask = calc_cow_mask(qcow2, map->ext_l2, qio, > + true, map->clu_is_cow, false); The new_ext_l2 and calc_cow_mask() lines change only from qio->ext-> to ext->; please leave them as they were, so the diff shows the logic change only. > cluster stays where it is. map->backing_file_cow becomes sliced_cow, > and qio_ext gets cow_in_place for the non-extended case, where the L2 > entry is still rewritten. The rename needs no sentence. What the reader needs is why cow_in_place exists: only_set_ext_l2 cannot mark an in-place write on a non-extended image, where the L2 entry must still be rewritten to drop the zero flag. It is set in both modes, so "for the non-extended case" reads as if it were set only there. > backing file COW of a write whose other border is in an unallocated > subcluster copies only that subcluster. "Other" than which border? Something like "a write with one border in an unallocated subcluster and the other in a zero subcluster" says it directly. -- Konstantin Khorenko, Virtuozzo Linux Kernel Team _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel