* [Devel] [PATCH hci-8.2 0/4] dm-qcow2: fix the revert of a failed L2 writeback
@ 2026-11-19 1:08 Denis V. Lunev
2026-11-19 1:08 ` [Devel] [PATCH hci-8.2 1/4] dm-qcow2: keep the zero flag of an L2 entry when its writeback fails Denis V. Lunev
` (6 more replies)
0 siblings, 7 replies; 16+ messages in thread
From: Denis V. Lunev @ 2026-11-19 1:08 UTC (permalink / raw)
To: alexander.ivanov, vasileios.almpanis; +Cc: devel
A failed L2 writeback reverts the page in memory, and the revert can
leave entries that send I/O to the wrong place. An all-zeroes entry
loses its flag and shows backing data again. On ext_l2 images,
subclusters stay marked allocated with offset 0, so their I/O goes to
cluster 0, where the image header lives. The last patch makes dm-qcow2
refuse such entries already on disk.
https://virtuozzo.atlassian.net/browse/VSTOR-154311
https://virtuozzo.atlassian.net/browse/VSTOR-154310
Tested in an HCI 8.2 VM with the L2 writeback failure injected: each
case reproduces on stock and not with the series, and the ploop test
suite passes in qcow2 and ploop formats.
Denis V. Lunev (4):
dm-qcow2: keep the zero flag of an L2 entry when its writeback fails
dm-qcow2: fix ext_l2 subclusters mapped to cluster 0 after a write
error
dm-qcow2: delay a backing-file COW while its L2 entry awaits writeback
dm-qcow2: refuse an ext_l2 entry with allocated subclusters and no
cluster
drivers/md/dm-qcow2-map.c | 35 ++++++++++++++++++++++++++++++-----
1 file changed, 30 insertions(+), 5 deletions(-)
--
2.55.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Devel] [PATCH hci-8.2 1/4] dm-qcow2: keep the zero flag of an L2 entry when its writeback fails
2026-11-19 1:08 [Devel] [PATCH hci-8.2 0/4] dm-qcow2: fix the revert of a failed L2 writeback Denis V. Lunev
@ 2026-11-19 1:08 ` Denis V. Lunev
2026-11-19 1:14 ` no-reply
2026-11-19 16:33 ` Konstantin Khorenko
2026-11-19 1:08 ` [Devel] [PATCH hci-8.2 2/4] dm-qcow2: fix ext_l2 subclusters mapped to cluster 0 after a write error Denis V. Lunev
` (5 subsequent siblings)
6 siblings, 2 replies; 16+ messages in thread
From: Denis V. Lunev @ 2026-11-19 1:08 UTC (permalink / raw)
To: alexander.ivanov, vasileios.almpanis; +Cc: devel
From: Denis V. Lunev <den@openvz.org>
On an image without extended L2 entries, a write to a cluster whose L2
entry has only L2_READS_ALL_ZEROES set allocates a data cluster without
asking for pe_page: prepare_l1l2_allocation() wants one only for a
preallocated cluster. If the L2 writeback fails, the revert finds no
saved value and writes 0 to the entry, so the cluster reads from the
backing image again. A discard of a cluster that may be mapped in a
lower delta leaves exactly such an entry, and after an L2 write error
the guest reads stale backing data where it discarded the cluster.
Ask for pe_page whenever the entry reads as zeroes. A preallocated
entry is one of these.
https://virtuozzo.atlassian.net/browse/VSTOR-154311
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 <den@openvz.org>
---
drivers/md/dm-qcow2-map.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c
index 32373114580e..ea4dbd949897 100644
--- a/drivers/md/dm-qcow2-map.c
+++ b/drivers/md/dm-qcow2-map.c
@@ -2763,7 +2763,7 @@ static int prepare_l1l2_allocation(struct qcow2 *qcow2, struct qio *qio,
map->compressed || map->clu_is_cow);
/* Allocate cluster for DATA, and prepare L2 update */
arg_mask = LU_SET_ONE_MASK;
- if (map->prealloced || qcow2->ext_l2)
+ if (map->all_zeroes || qcow2->ext_l2)
arg_mask |= LU_WANTS_PE_PAGE;
if (!map->prealloced)
arg_mask |= LU_WANTS_ALLOC;
--
2.55.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Devel] [PATCH hci-8.2 2/4] dm-qcow2: fix ext_l2 subclusters mapped to cluster 0 after a write error
2026-11-19 1:08 [Devel] [PATCH hci-8.2 0/4] dm-qcow2: fix the revert of a failed L2 writeback Denis V. Lunev
2026-11-19 1:08 ` [Devel] [PATCH hci-8.2 1/4] dm-qcow2: keep the zero flag of an L2 entry when its writeback fails Denis V. Lunev
@ 2026-11-19 1:08 ` Denis V. Lunev
2026-11-19 1:14 ` no-reply
2026-11-19 16:33 ` Konstantin Khorenko
2026-11-19 1:08 ` [Devel] [PATCH hci-8.2 3/4] dm-qcow2: delay a backing-file COW while its L2 entry awaits writeback Denis V. Lunev
` (4 subsequent siblings)
6 siblings, 2 replies; 16+ messages in thread
From: Denis V. Lunev @ 2026-11-19 1:08 UTC (permalink / raw)
To: alexander.ivanov, vasileios.almpanis; +Cc: devel
From: Denis V. Lunev <den@openvz.org>
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 <den@openvz.org>
---
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Devel] [PATCH hci-8.2 3/4] dm-qcow2: delay a backing-file COW while its L2 entry awaits writeback
2026-11-19 1:08 [Devel] [PATCH hci-8.2 0/4] dm-qcow2: fix the revert of a failed L2 writeback Denis V. Lunev
2026-11-19 1:08 ` [Devel] [PATCH hci-8.2 1/4] dm-qcow2: keep the zero flag of an L2 entry when its writeback fails Denis V. Lunev
2026-11-19 1:08 ` [Devel] [PATCH hci-8.2 2/4] dm-qcow2: fix ext_l2 subclusters mapped to cluster 0 after a write error Denis V. Lunev
@ 2026-11-19 1:08 ` Denis V. Lunev
2026-11-19 1:16 ` no-reply
2026-11-19 16:33 ` Konstantin Khorenko
2026-11-19 1:08 ` [Devel] [PATCH hci-8.2 4/4] dm-qcow2: refuse an ext_l2 entry with allocated subclusters and no cluster Denis V. Lunev
` (3 subsequent siblings)
6 siblings, 2 replies; 16+ messages in thread
From: Denis V. Lunev @ 2026-11-19 1:08 UTC (permalink / raw)
To: alexander.ivanov, vasileios.almpanis; +Cc: devel
From: Denis V. Lunev <den@openvz.org>
On an ext_l2 image with a backing file, a write that covers part of an
unallocated subcluster is a backing-file COW. Writes are not delayed on
a dirty L2 entry, so such a write can follow, in the same worker pass,
the write that allocated its cluster. It finds the cluster in memory,
keeps it (only_set_ext_l2) and computes the new subcluster bitmap from
the dirty entry, but does not join the writeback of that entry. If the
writeback fails, the revert sets the entry back to offset 0, and the
COW then installs its bitmap over it and completes. Its data went to a
cluster that nothing maps, and later I/O to those subclusters goes to
cluster 0, where the image header lives.
Delay the COW while its L2 entry or the subcluster bitmap is dirty, as
prepare_cluster_discard() does. Only a write that partly covers a
subcluster of a cluster allocated in the same worker pass waits longer.
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 <den@openvz.org>
---
drivers/md/dm-qcow2-map.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c
index d1ec79189f81..fedf9ac4e6e3 100644
--- a/drivers/md/dm-qcow2-map.c
+++ b/drivers/md/dm-qcow2-map.c
@@ -3703,6 +3703,21 @@ static int prepare_cluster_discard(struct qcow2 *qcow2, struct qio **qio,
return 1;
}
+static bool delay_if_l2_dirty(struct qcow2 *qcow2, struct qcow2_map *map,
+ struct qio **qio)
+{
+ struct md_page *md = map->l2.md;
+ u32 index_in_page = map->l2.index_in_page;
+ bool ret;
+
+ spin_lock_irq(&qcow2->md_pages_lock);
+ ret = delay_if_dirty(qcow2, md, index_in_page, qio) ||
+ (qcow2->ext_l2 &&
+ delay_if_dirty(qcow2, md, index_in_page + 1, qio));
+ spin_unlock_irq(&qcow2->md_pages_lock);
+ return ret;
+}
+
static int handle_metadata(struct qcow2 *qcow2, struct qio **qio,
struct qcow2_map *map)
{
@@ -3748,7 +3763,10 @@ static int handle_metadata(struct qcow2 *qcow2, struct qio **qio,
* snapshots). Here is data COW on L2_LEVEL.
*/
map->backing_file_cow = true;
- ret = prepare_l1l2_replace(qcow2, *qio, map);
+ if (delay_if_l2_dirty(qcow2, map, qio))
+ ret = 0;
+ else
+ ret = prepare_l1l2_replace(qcow2, *qio, map);
} else {
/* Wants L1 or L2 entry allocation */
ret = prepare_l1l2_allocation(qcow2, *qio, map);
--
2.55.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Devel] [PATCH hci-8.2 4/4] dm-qcow2: refuse an ext_l2 entry with allocated subclusters and no cluster
2026-11-19 1:08 [Devel] [PATCH hci-8.2 0/4] dm-qcow2: fix the revert of a failed L2 writeback Denis V. Lunev
` (2 preceding siblings ...)
2026-11-19 1:08 ` [Devel] [PATCH hci-8.2 3/4] dm-qcow2: delay a backing-file COW while its L2 entry awaits writeback Denis V. Lunev
@ 2026-11-19 1:08 ` Denis V. Lunev
2026-11-19 1:19 ` no-reply
2026-11-19 16:33 ` Konstantin Khorenko
2026-11-19 12:34 ` [Devel] [PATCH hci-8.2 0/4] dm-qcow2: fix the revert of a failed L2 writeback Alexander Ivanov
` (2 subsequent siblings)
6 siblings, 2 replies; 16+ messages in thread
From: Denis V. Lunev @ 2026-11-19 1:08 UTC (permalink / raw)
To: alexander.ivanov, vasileios.almpanis; +Cc: devel
From: Denis V. Lunev <den@openvz.org>
An extended L2 entry with a zero cluster offset and allocation bits set
is invalid, and qemu reports it as corruption. parse_l2() accepts it,
and I/O to those subclusters then goes to cluster 0, where the image
header lives. A failed L2 writeback could leave such entries on disk
before the previous fixes, so images may already carry them.
Fail I/O to such a cluster with -EIO and log the entry. qemu fails only
the invalid subclusters, but the entry is corrupt either way.
https://virtuozzo.atlassian.net/browse/VSTOR-154310
Feature: dm-qcow2: block device over QCOW2 files driver
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
drivers/md/dm-qcow2-map.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c
index fedf9ac4e6e3..89e569d09133 100644
--- a/drivers/md/dm-qcow2-map.c
+++ b/drivers/md/dm-qcow2-map.c
@@ -1979,6 +1979,12 @@ static loff_t parse_l2(struct qcow2 *qcow2, struct qcow2_map *map,
if (WARN_ON_ONCE(all_zeroes || (ext_l2 & (ext_l2 >> 32))))
goto out;
+ if (!pos && (u32)ext_l2) {
+ pr_err_ratelimited(QCOW2_FMT("invalid ext_l2 entry %u in page %llu"),
+ qcow2_device_name(qcow2->tgt->ti),
+ l2->index_in_page, l2->md->id);
+ goto out;
+ }
/*
* Note, that if "l2->index_in_page" is changed,
--
2.55.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Devel] [PATCH hci-8.2 1/4] dm-qcow2: keep the zero flag of an L2 entry when its writeback fails
2026-11-19 1:08 ` [Devel] [PATCH hci-8.2 1/4] dm-qcow2: keep the zero flag of an L2 entry when its writeback fails Denis V. Lunev
@ 2026-11-19 1:14 ` no-reply
2026-11-19 16:33 ` Konstantin Khorenko
1 sibling, 0 replies; 16+ messages in thread
From: no-reply @ 2026-11-19 1:14 UTC (permalink / raw)
To: Denis V. Lunev, alexander.ivanov, vasileios.almpanis; +Cc: devel
> From: Denis V. Lunev <den@openvz.org>
>
> On an image without extended L2 entries, a write to a cluster whose L2
> entry has only L2_READS_ALL_ZEROES set allocates a data cluster without
> asking for pe_page: prepare_l1l2_allocation() wants one only for a
> preallocated cluster. If the L2 writeback fails, the revert finds no
> saved value and writes 0 to the entry, so the cluster reads from the
> backing image again. A discard of a cluster that may be mapped in a
> lower delta leaves exactly such an entry, and after an L2 write error
> the guest reads stale backing data where it discarded the cluster.
>
> Ask for pe_page whenever the entry reads as zeroes. A preallocated
> entry is one of these.
>
> https://virtuozzo.atlassian.net/browse/VSTOR-154311
>
> 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 <den@openvz.org>
Sashiko has reviewed this patch and found no issues.
Carry the trailer below into the next revision and Sashiko will not review this patch again.
Reviewed-by: Sashiko <no-reply@sashiko.virtuozzo.com>
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261119010854.4107497-1-den@openvz.org?part=1
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Devel] [PATCH hci-8.2 2/4] dm-qcow2: fix ext_l2 subclusters mapped to cluster 0 after a write error
2026-11-19 1:08 ` [Devel] [PATCH hci-8.2 2/4] dm-qcow2: fix ext_l2 subclusters mapped to cluster 0 after a write error Denis V. Lunev
@ 2026-11-19 1:14 ` no-reply
2026-11-19 16:33 ` Konstantin Khorenko
1 sibling, 0 replies; 16+ messages in thread
From: no-reply @ 2026-11-19 1:14 UTC (permalink / raw)
To: Denis V. Lunev, alexander.ivanov, vasileios.almpanis; +Cc: devel
> From: Denis V. Lunev <den@openvz.org>
>
> 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 <den@openvz.org>
Sashiko has reviewed this patch and found no issues.
Carry the trailer below into the next revision and Sashiko will not review this patch again.
Reviewed-by: Sashiko <no-reply@sashiko.virtuozzo.com>
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261119010854.4107497-1-den@openvz.org?part=2
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Devel] [PATCH hci-8.2 3/4] dm-qcow2: delay a backing-file COW while its L2 entry awaits writeback
2026-11-19 1:08 ` [Devel] [PATCH hci-8.2 3/4] dm-qcow2: delay a backing-file COW while its L2 entry awaits writeback Denis V. Lunev
@ 2026-11-19 1:16 ` no-reply
2026-11-19 16:33 ` Konstantin Khorenko
1 sibling, 0 replies; 16+ messages in thread
From: no-reply @ 2026-11-19 1:16 UTC (permalink / raw)
To: Denis V. Lunev, alexander.ivanov, vasileios.almpanis; +Cc: devel
> From: Denis V. Lunev <den@openvz.org>
>
> On an ext_l2 image with a backing file, a write that covers part of an
> unallocated subcluster is a backing-file COW. Writes are not delayed on
> a dirty L2 entry, so such a write can follow, in the same worker pass,
> the write that allocated its cluster. It finds the cluster in memory,
> keeps it (only_set_ext_l2) and computes the new subcluster bitmap from
> the dirty entry, but does not join the writeback of that entry. If the
> writeback fails, the revert sets the entry back to offset 0, and the
> COW then installs its bitmap over it and completes. Its data went to a
> cluster that nothing maps, and later I/O to those subclusters goes to
> cluster 0, where the image header lives.
>
> Delay the COW while its L2 entry or the subcluster bitmap is dirty, as
> prepare_cluster_discard() does. Only a write that partly covers a
> subcluster of a cluster allocated in the same worker pass waits longer.
>
> 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 <den@openvz.org>
Sashiko has reviewed this patch and found no issues.
Carry the trailer below into the next revision and Sashiko will not review this patch again.
Reviewed-by: Sashiko <no-reply@sashiko.virtuozzo.com>
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261119010854.4107497-1-den@openvz.org?part=3
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Devel] [PATCH hci-8.2 4/4] dm-qcow2: refuse an ext_l2 entry with allocated subclusters and no cluster
2026-11-19 1:08 ` [Devel] [PATCH hci-8.2 4/4] dm-qcow2: refuse an ext_l2 entry with allocated subclusters and no cluster Denis V. Lunev
@ 2026-11-19 1:19 ` no-reply
2026-11-19 16:33 ` Konstantin Khorenko
1 sibling, 0 replies; 16+ messages in thread
From: no-reply @ 2026-11-19 1:19 UTC (permalink / raw)
To: Denis V. Lunev, alexander.ivanov, vasileios.almpanis; +Cc: devel
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] dm-qcow2: invalid ext_l2 log omits ext_l2 value and mislabels
slot index
--
commit 5f7dc486050747667fda758b5b82e3cacd6d9c6f
Author: Denis V. Lunev <den@openvz.org>
dm-qcow2: refuse an ext_l2 entry with allocated subclusters and no cluster
This commit makes parse_l2() fail I/O with -EIO when an extended L2 entry has a zero cluster offset but allocation bits set. It also logs a ratelimited error message.
> diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c
> index fedf9ac4e6e3..89e569d09133 100644
> --- a/drivers/md/dm-qcow2-map.c
> +++ b/drivers/md/dm-qcow2-map.c
> @@ -1979,6 +1979,12 @@ static loff_t parse_l2(struct qcow2 *qcow2, struct qcow2_map *map,
>
> if (WARN_ON_ONCE(all_zeroes || (ext_l2 & (ext_l2 >> 32))))
> goto out;
> + if (!pos && (u32)ext_l2) {
> + pr_err_ratelimited(QCOW2_FMT("invalid ext_l2 entry %u in page %llu"),
> + qcow2_device_name(qcow2->tgt->ti),
> + l2->index_in_page, l2->md->id);
> + goto out;
> + }
[Severity: Low]
The commit message says it will "log the entry", but the message prints only index_in_page and the md page id. It doesn't print the ext_l2 word that holds the allocation bits, so an admin can't see which subclusters are marked allocated without decoding the page by hand.
index_in_page is a u64-slot index, which is always even for extended L2 and twice the entry number. Can the "entry %u" label be misread as an entry number or value? Would it be clearer to print ext_l2 (for example with %016llx) and to label the index as a slot?
Carry the trailer below into the next revision and Sashiko will not review this patch again.
Reviewed-by: Sashiko <no-reply@sashiko.virtuozzo.com>
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261119010854.4107497-1-den@openvz.org?part=4
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Devel] [PATCH hci-8.2 0/4] dm-qcow2: fix the revert of a failed L2 writeback
2026-11-19 1:08 [Devel] [PATCH hci-8.2 0/4] dm-qcow2: fix the revert of a failed L2 writeback Denis V. Lunev
` (3 preceding siblings ...)
2026-11-19 1:08 ` [Devel] [PATCH hci-8.2 4/4] dm-qcow2: refuse an ext_l2 entry with allocated subclusters and no cluster Denis V. Lunev
@ 2026-11-19 12:34 ` Alexander Ivanov
2026-11-19 16:33 ` Konstantin Khorenko
2026-11-19 16:33 ` Konstantin Khorenko
6 siblings, 0 replies; 16+ messages in thread
From: Alexander Ivanov @ 2026-11-19 12:34 UTC (permalink / raw)
To: Denis V. Lunev, vasileios.almpanis; +Cc: devel
LGTM
Reviewed-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Devel] [PATCH hci-8.2 0/4] dm-qcow2: fix the revert of a failed L2 writeback
2026-11-19 1:08 [Devel] [PATCH hci-8.2 0/4] dm-qcow2: fix the revert of a failed L2 writeback Denis V. Lunev
` (4 preceding siblings ...)
2026-11-19 12:34 ` [Devel] [PATCH hci-8.2 0/4] dm-qcow2: fix the revert of a failed L2 writeback Alexander Ivanov
@ 2026-11-19 16:33 ` Konstantin Khorenko
2026-11-19 16:33 ` Konstantin Khorenko
6 siblings, 0 replies; 16+ messages in thread
From: Konstantin Khorenko @ 2026-11-19 16:33 UTC (permalink / raw)
To: Denis V. Lunev; +Cc: devel
Applying the series with these fixes on my side:
1. 3/4: the last sentence of the message is too narrow: a write that
partly covers a subcluster also waits when the cluster was
allocated earlier and another write of the same pass changed its
bitmap. Reworded.
2. 3/4: split the first paragraph of the message.
3. 4/4: "qemu fails only the invalid subclusters" is wrong: qemu
treats every subcluster of such an entry as invalid and marks the
image corrupt on the first access. Reworded.
Separate patches, not needed for this series. I created a task for it:
1. 4/4 logs the u64 slot index as "entry" (twice the entry number on
ext_l2) and does not print the allocation bitmap, as Sashiko
noted. Please print the ext_l2 word and the entry number.
https://virtuozzo.atlassian.net/browse/VSTOR-156041
On Thu, 19 Nov 2026 02:08:50 +0100, Denis V. Lunev wrote:
> Tested in an HCI 8.2 VM with the L2 writeback failure injected: each
> case reproduces on stock and not with the series, and the ploop test
> suite passes in qcow2 and ploop formats.
How was the L2 writeback failure injected? Please put that into
VSTOR-154310, so the test can be repeated.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Devel] [PATCH hci-8.2 2/4] dm-qcow2: fix ext_l2 subclusters mapped to cluster 0 after a write error
2026-11-19 1:08 ` [Devel] [PATCH hci-8.2 2/4] dm-qcow2: fix ext_l2 subclusters mapped to cluster 0 after a write error Denis V. Lunev
2026-11-19 1:14 ` no-reply
@ 2026-11-19 16:33 ` Konstantin Khorenko
1 sibling, 0 replies; 16+ messages in thread
From: Konstantin Khorenko @ 2026-11-19 16:33 UTC (permalink / raw)
To: Denis V. Lunev; +Cc: devel
Applying as is.
On Thu, 19 Nov 2026 02:08:52 +0100, Denis V. Lunev wrote:
> Save the old value only on the first change of an index in a writeback.
Thanks.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Devel] [PATCH hci-8.2 3/4] dm-qcow2: delay a backing-file COW while its L2 entry awaits writeback
2026-11-19 1:08 ` [Devel] [PATCH hci-8.2 3/4] dm-qcow2: delay a backing-file COW while its L2 entry awaits writeback Denis V. Lunev
2026-11-19 1:16 ` no-reply
@ 2026-11-19 16:33 ` Konstantin Khorenko
1 sibling, 0 replies; 16+ messages in thread
From: Konstantin Khorenko @ 2026-11-19 16:33 UTC (permalink / raw)
To: Denis V. Lunev; +Cc: devel
Applying with these fixes on my side:
- Items 1 and 2 of the cover letter reply: reworded the last sentence
and split the first paragraph of the message.
On Thu, 19 Nov 2026 02:08:53 +0100, Denis V. Lunev wrote:
> Delay the COW while its L2 entry or the subcluster bitmap is dirty, as
> prepare_cluster_discard() does. Only a write that partly covers a
> subcluster of a cluster allocated in the same worker pass waits longer.
The bitmap is dirty also when the cluster was allocated long ago and
another write of the same pass filled one of its subclusters, and the
COW has to wait then too. Now: "Only a write that partly covers an
unallocated subcluster of a cluster whose L2 entry changed in the same
worker pass waits longer."
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Devel] [PATCH hci-8.2 4/4] dm-qcow2: refuse an ext_l2 entry with allocated subclusters and no cluster
2026-11-19 1:08 ` [Devel] [PATCH hci-8.2 4/4] dm-qcow2: refuse an ext_l2 entry with allocated subclusters and no cluster Denis V. Lunev
2026-11-19 1:19 ` no-reply
@ 2026-11-19 16:33 ` Konstantin Khorenko
1 sibling, 0 replies; 16+ messages in thread
From: Konstantin Khorenko @ 2026-11-19 16:33 UTC (permalink / raw)
To: Denis V. Lunev; +Cc: devel
Applying with these fixes on my side:
- Item 3 of the cover letter reply: reworded the qemu sentence.
On Thu, 19 Nov 2026 02:08:54 +0100, Denis V. Lunev wrote:
> Fail I/O to such a cluster with -EIO and log the entry. qemu fails only
> the invalid subclusters, but the entry is corrupt either way.
qcow2_get_subcluster_type() returns INVALID for every subcluster of an
unallocated cluster once any allocation bit is set, and the I/O path
then calls qcow2_signal_corruption(), which stops all I/O to the image.
Now: "qemu treats every subcluster of such an entry as invalid too and
marks the image corrupt."
The log line is item 1 of the separate patches in the cover letter
reply.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Devel] [PATCH hci-8.2 1/4] dm-qcow2: keep the zero flag of an L2 entry when its writeback fails
2026-11-19 1:08 ` [Devel] [PATCH hci-8.2 1/4] dm-qcow2: keep the zero flag of an L2 entry when its writeback fails Denis V. Lunev
2026-11-19 1:14 ` no-reply
@ 2026-11-19 16:33 ` Konstantin Khorenko
1 sibling, 0 replies; 16+ messages in thread
From: Konstantin Khorenko @ 2026-11-19 16:33 UTC (permalink / raw)
To: Denis V. Lunev; +Cc: devel
Applying as is.
On Thu, 19 Nov 2026 02:08:51 +0100, Denis V. Lunev wrote:
> Ask for pe_page whenever the entry reads as zeroes. A preallocated
> entry is one of these.
Thanks.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Devel] [PATCH hci-8.2 0/4] dm-qcow2: fix the revert of a failed L2 writeback
2026-11-19 1:08 [Devel] [PATCH hci-8.2 0/4] dm-qcow2: fix the revert of a failed L2 writeback Denis V. Lunev
` (5 preceding siblings ...)
2026-11-19 16:33 ` Konstantin Khorenko
@ 2026-11-19 16:33 ` Konstantin Khorenko
6 siblings, 0 replies; 16+ messages in thread
From: Konstantin Khorenko @ 2026-11-19 16:33 UTC (permalink / raw)
To: alexander.ivanov, vasileios.almpanis, Denis V. Lunev; +Cc: devel
On Thu, 19 Nov 2026 02:08:50 +0100, Denis V. Lunev wrote:
> dm-qcow2: fix the revert of a failed L2 writeback
>
> A failed L2 writeback reverts the page in memory, and the revert can
> leave entries that send I/O to the wrong place. An all-zeroes entry
> loses its flag and shows backing data again. On ext_l2 images,
> subclusters stay marked allocated with offset 0, so their I/O goes to
> cluster 0, where the image header lives. The last patch makes dm-qcow2
> refuse such entries already on disk.
>
> [...]
Applied to branch-rh10-6.12.0-211.75.1.26.x.vz10-ovz, will be released in rh10-6.12.0-211.75.1.26.4.vz10, thanks!
[1/4] dm-qcow2: keep the zero flag of an L2 entry when its writeback fails
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/8584282d4e93
[2/4] dm-qcow2: fix ext_l2 subclusters mapped to cluster 0 after a write error
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/6a3504deb5a3
[3/4] dm-qcow2: delay a backing-file COW while its L2 entry awaits writeback
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/aa7d9904e80d
[4/4] dm-qcow2: refuse an ext_l2 entry with allocated subclusters and no cluster
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/be4c890fb272
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2026-11-19 16:36 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19 1:08 [Devel] [PATCH hci-8.2 0/4] dm-qcow2: fix the revert of a failed L2 writeback Denis V. Lunev
2026-11-19 1:08 ` [Devel] [PATCH hci-8.2 1/4] dm-qcow2: keep the zero flag of an L2 entry when its writeback fails Denis V. Lunev
2026-11-19 1:14 ` no-reply
2026-11-19 16:33 ` Konstantin Khorenko
2026-11-19 1:08 ` [Devel] [PATCH hci-8.2 2/4] dm-qcow2: fix ext_l2 subclusters mapped to cluster 0 after a write error Denis V. Lunev
2026-11-19 1:14 ` no-reply
2026-11-19 16:33 ` Konstantin Khorenko
2026-11-19 1:08 ` [Devel] [PATCH hci-8.2 3/4] dm-qcow2: delay a backing-file COW while its L2 entry awaits writeback Denis V. Lunev
2026-11-19 1:16 ` no-reply
2026-11-19 16:33 ` Konstantin Khorenko
2026-11-19 1:08 ` [Devel] [PATCH hci-8.2 4/4] dm-qcow2: refuse an ext_l2 entry with allocated subclusters and no cluster Denis V. Lunev
2026-11-19 1:19 ` no-reply
2026-11-19 16:33 ` Konstantin Khorenko
2026-11-19 12:34 ` [Devel] [PATCH hci-8.2 0/4] dm-qcow2: fix the revert of a failed L2 writeback Alexander Ivanov
2026-11-19 16:33 ` Konstantin Khorenko
2026-11-19 16:33 ` Konstantin Khorenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox