From: Konstantin Khorenko <khorenko@virtuozzo.com>
To: "Denis V. Lunev" <den@openvz.org>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.2 v2] dm-qcow2: fix stale host data showing in a zero cluster after a write
Date: Tue, 24 Nov 2026 14:16:29 +0100 [thread overview]
Message-ID: <179552618902.15442.1907084102807179050.b4-review@b4> (raw)
In-Reply-To: <20261124124613.455047-1-den@openvz.org>
I won't apply this version, please send v3 with the changes below.
On Tue, 24 Nov 2026 13:46:13 +0100, Denis V. Lunev wrote:
> dm-qcow2: fix stale host data showing in a zero cluster after a write
- Keep the unallocated subcluster case, but do not pay for it on
clusters dm-qcow2 allocated itself: their unused subclusters are
zero on disk already.
- Commit message: split the last sentence of the first paragraph, and
the subject should cover unallocated subclusters too.
All four v1 asks are done, and the code is correct. The problem is the
price of my first v1 ask as it is done here.
> + if (!maybe_mapped_in_lower_delta(qcow2, qio))
> + mask |= ~((u32)map->ext_l2 | zeroes);
prepare_l1l2_allocation() sets the alloc bits of the written
subclusters only, so every cluster dm-qcow2 allocates has unallocated
subclusters, and without backing data each of them now takes this
path. ploop creates images with 1M clusters and extended L2 entries,
so this is the default CT disk without snapshots. A 4K write into a
fresh subcluster used to set the bit and go out at once, with the L2
writeback in parallel. Now it waits for a dirty L2, locks the L2 entry
so all I/O to the 1M cluster waits, writes 32K of which 28K are
zeroes, and completes only after its own L2 writeback. That is up to
31 times per cluster, and host holes become allocated blocks.
Those zeroes buy nothing: prepare_unused_cluster() punches a reused
area below file_preallocated_area_start and the area past it is fresh,
and our own discard punches too. Stale data can come only from
clusters qemu wrote. One way: when dm-qcow2 allocates a cluster that
has no backing data, set all its alloc bits at once (the check must
look at the cluster, not at the write start); then only qemu-written
clusters take the COW. If you see a cheaper way, fine too, but please
show fio numbers for 4K random and sequential writes on a fresh 1M
extended L2 image without backing, before and after.
> unit reads back the stale data instead of zeroes:
> prepare_l1l2_allocation() reuses the host cluster as it is, and the
> backing file COW of a write with one border in an unallocated
> subcluster and the other in a zero subcluster copies only the
> unallocated one.
This sentence runs eight lines and joins two mechanisms with a colon;
please split it. The subject still says "zero cluster" while the patch
now fixes unallocated subclusters as well.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-11-24 13:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 12:46 Denis V. Lunev
2026-11-24 13:16 ` Konstantin Khorenko [this message]
2026-11-25 1:07 ` Andrey Zhadchenko
2026-12-01 0:06 ` no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179552618902.15442.1907084102807179050.b4-review@b4 \
--to=khorenko@virtuozzo.com \
--cc=den@openvz.org \
--cc=devel@openvz.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox