OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
* [Devel] [PATCH hci-8.1] dm-ploop: fix a forward notify_merged updating the wrong delta
@ 2026-11-04 18:55 Denis V. Lunev
  2026-11-04 18:58 ` no-reply
  2026-11-04 19:14 ` Konstantin Khorenko
  0 siblings, 2 replies; 3+ messages in thread
From: Denis V. Lunev @ 2026-11-04 18:55 UTC (permalink / raw)
  To: andrey.zhadchenko; +Cc: devel

From: Denis V. Lunev <den@openvz.org>

ploop_delta_clusters_merged() rereads the delta that took the clusters,
deltas[level + 1] for a forward merge, and stores its file_size,
file_preallocated_area_start and nr_be after notify_delta_merged(). By
then notify_delta_merged() has moved the deltas above @level one slot
down, so the values land in the delta above the one they belong to,
and that one keeps its sizes from before the merge.

With level == top - 2 the top delta gets the sizes and nr_be of the
delta below it. The sizes drive the preallocation of whichever delta
is on top, and nr_be bounds later merges into a delta, so both deltas
are left with wrong values. The ploop library sends only
notify_merged_backward, so this takes a direct dm message.

Store the values into deltas[level] for a forward merge. A backward
merge changes the delta below @level, which does not move.

Fixes: 6ddad5a4d226 ("dm-ploop: Add ploop target driver")
Reported-by: Konstantin Khorenko <khorenko@virtuozzo.com>
https://virtuozzo.atlassian.net/browse/VSTOR-153426
Feature: dm-ploop: ploop target driver
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
 drivers/md/dm-ploop-cmd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
index 645c5136e7ba..196cd7da306c 100644
--- a/drivers/md/dm-ploop-cmd.c
+++ b/drivers/md/dm-ploop-cmd.c
@@ -918,6 +918,9 @@ static int ploop_delta_clusters_merged(struct ploop *ploop, u8 level,
 
 	notify_delta_merged(ploop, level, &md_root, forward, nr_be);
 
+	/* notify_delta_merged() moved the deltas above @level one slot down */
+	if (forward)
+		changed_level = level;
 	deltas[changed_level].file_size = file_size;
 	deltas[changed_level].file_preallocated_area_start = file_size;
 	deltas[changed_level].nr_be = nr_be;

base-commit: 95ab11e2c57e8468412ca586d4be8cd75b6bfbf0
-- 
2.53.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Devel] [PATCH hci-8.1] dm-ploop: fix a forward notify_merged updating the wrong delta
  2026-11-04 18:55 [Devel] [PATCH hci-8.1] dm-ploop: fix a forward notify_merged updating the wrong delta Denis V. Lunev
@ 2026-11-04 18:58 ` no-reply
  2026-11-04 19:14 ` Konstantin Khorenko
  1 sibling, 0 replies; 3+ messages in thread
From: no-reply @ 2026-11-04 18:58 UTC (permalink / raw)
  To: andrey.zhadchenko, Denis V. Lunev; +Cc: devel

> From: Denis V. Lunev <den@openvz.org>
> 
> ploop_delta_clusters_merged() rereads the delta that took the clusters,
> deltas[level + 1] for a forward merge, and stores its file_size,
> file_preallocated_area_start and nr_be after notify_delta_merged(). By
> then notify_delta_merged() has moved the deltas above @level one slot
> down, so the values land in the delta above the one they belong to,
> and that one keeps its sizes from before the merge.
> 
> With level == top - 2 the top delta gets the sizes and nr_be of the
> delta below it. The sizes drive the preallocation of whichever delta
> is on top, and nr_be bounds later merges into a delta, so both deltas
> are left with wrong values. The ploop library sends only
> notify_merged_backward, so this takes a direct dm message.
> 
> Store the values into deltas[level] for a forward merge. A backward
> merge changes the delta below @level, which does not move.
> 
> Fixes: 6ddad5a4d226 ("dm-ploop: Add ploop target driver")
> Reported-by: Konstantin Khorenko <khorenko@virtuozzo.com>
> https://virtuozzo.atlassian.net/browse/VSTOR-153426
> Feature: dm-ploop: ploop target driver
> Signed-off-by: Denis V. Lunev <den@openvz.org>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261104185531.1870776-1-den@openvz.org?part=1


_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Devel] [PATCH hci-8.1] dm-ploop: fix a forward notify_merged updating the wrong delta
  2026-11-04 18:55 [Devel] [PATCH hci-8.1] dm-ploop: fix a forward notify_merged updating the wrong delta Denis V. Lunev
  2026-11-04 18:58 ` no-reply
@ 2026-11-04 19:14 ` Konstantin Khorenko
  1 sibling, 0 replies; 3+ messages in thread
From: Konstantin Khorenko @ 2026-11-04 19:14 UTC (permalink / raw)
  To: andrey.zhadchenko, Denis V. Lunev; +Cc: devel

On Wed, 04 Nov 2026 19:55:31 +0100, Denis V. Lunev wrote:
> dm-ploop: fix a forward notify_merged updating the wrong delta

Applied to branch-rh10-6.12.0-211.52.1.22.x.vz10-ovz, will be released in rh10-6.12.0-211.52.1.22.18.vz10, thanks!

[1/1] dm-ploop: fix a forward notify_merged updating the wrong delta
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/f0b4d6608f71

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team


_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-04 19:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04 18:55 [Devel] [PATCH hci-8.1] dm-ploop: fix a forward notify_merged updating the wrong delta Denis V. Lunev
2026-11-04 18:58 ` no-reply
2026-11-04 19:14 ` Konstantin Khorenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox