OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
* [Devel] [PATCH hci-8.1 0/2] dm-ploop, dm-qcow2: fix merge status shared by all devices
@ 2026-10-27 17:49 Denis V. Lunev
  2026-10-27 17:49 ` [Devel] [PATCH hci-8.1 1/2] dm-ploop: fix a failed merge failing every later merge on the host Denis V. Lunev
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Denis V. Lunev @ 2026-10-27 17:49 UTC (permalink / raw)
  To: andrey.zhadchenko; +Cc: devel

dm-ploop and dm-qcow2 collect the status of their merge service I/O in
a function-local static, so every device on the host shares one copy.

In dm-ploop it is never reset: after a single failed fake merge pio,
every later online merge on any ploop device stops after its first pio
and returns that old error until the module is reloaded, which on a
working node means a reboot.

dm-qcow2 resets it when each run starts, which makes it worse: a merge
or L1 COW break starting on one device wipes the error another device
has just recorded. That merge then reports success although a write
failed, userspace completes it and drops the top image, and the data
that never reached the lower image is gone.

The status goes on the stack. The pios/qios carry a pointer to it, so
both loops must not return while one is outstanding: every exit
already waits for the counter to drain, and a BUG_ON after the wait
stops the kernel rather than let a late pio/qio write into a dead
stack frame if that ever changes.

Tested on dev-cl04, 6.12.0-211.52.1.22.9.vz10 with the modules built
out of tree, using test-only module knobs to fail one service pio/qio:
- dm-ploop: after one injected failure, a merge on another device and a
  second merge on the same device both failed with EIO; with the fix
  both succeed;
- dm-qcow2: a backward merge with an injected qio error, held for 5 s
  while a merge on a second device started, returned success; with the
  fix it fails with "Can't break L1 COW";
- the ploop pytest suite, ploop and qcow2 formats, passes.

Denis V. Lunev (2):
  dm-ploop: fix a failed merge failing every later merge on the host
  dm-qcow2: fix a merge reporting success after a failed write

 drivers/md/dm-ploop-cmd.c | 4 +++-
 drivers/md/dm-qcow2-cmd.c | 6 +++---
 2 files changed, 6 insertions(+), 4 deletions(-)


base-commit: 02401c5e378f282fbf11bdc65996253ff65dad9b
-- 
2.53.0

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

^ permalink raw reply	[flat|nested] 6+ messages in thread
* [Devel] [PATCH hci-8.1 v2 0/2] dm-ploop, dm-qcow2: fix merge status shared by all devices
@ 2026-10-28 13:21 Denis V. Lunev
  2026-10-28 13:21 ` [Devel] [PATCH hci-8.1 2/2] dm-qcow2: fix a merge reporting success after a failed write Denis V. Lunev
  0 siblings, 1 reply; 6+ messages in thread
From: Denis V. Lunev @ 2026-10-28 13:21 UTC (permalink / raw)
  To: andrey.zhadchenko; +Cc: devel

dm-ploop and dm-qcow2 collect the status of their merge service I/O in
a function-local static, so every device on the host shares one copy.

In dm-ploop it is never reset: after a single failed fake merge pio,
every later online merge on any ploop device stops after its first pio
and returns that old error until the module is reloaded, which on a
working node means a reboot.

dm-qcow2 resets it when each run starts, which makes it worse: a merge
or L1 COW break starting on one device wipes the error another device
has just recorded. That merge then reports success although a write
failed, userspace completes it and drops the top image, and the data
that never reached the lower image is gone.

The status goes on the stack. The pios/qios carry a pointer to it, so
both loops must not return while one is outstanding: every exit
already waits for the counter to drain, and a BUG_ON after the wait
stops the kernel rather than let a late pio/qio write into a dead
stack frame if that ever changes.

Tested on dev-cl04, 6.12.0-211.52.1.22.9.vz10 with the modules built
out of tree, using test-only module knobs to fail one service pio/qio:
- dm-ploop: after one injected failure, a merge on another device and a
  second merge on the same device both failed with EIO; with the fix
  both succeed;
- dm-qcow2: a backward merge with an injected qio error, held for 5 s
  while a merge on a second device started, returned success; with the
  fix it fails with "Can't break L1 COW";
- the ploop pytest suite, ploop and qcow2 formats, passes.

Changes v1 -> v2:
- dropped BUG_ON

Denis V. Lunev (2):
  dm-ploop: fix a failed merge failing every later merge on the host
  dm-qcow2: fix a merge reporting success after a failed write

 drivers/md/dm-ploop-cmd.c | 4 +++-
 drivers/md/dm-qcow2-cmd.c | 6 +++---
 2 files changed, 6 insertions(+), 4 deletions(-)


base-commit: 02401c5e378f282fbf11bdc65996253ff65dad9b
-- 
2.53.0

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

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

end of thread, other threads:[~2026-10-28 13:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-27 17:49 [Devel] [PATCH hci-8.1 0/2] dm-ploop, dm-qcow2: fix merge status shared by all devices Denis V. Lunev
2026-10-27 17:49 ` [Devel] [PATCH hci-8.1 1/2] dm-ploop: fix a failed merge failing every later merge on the host Denis V. Lunev
2026-10-27 17:49 ` [Devel] [PATCH hci-8.1 2/2] dm-qcow2: fix a merge reporting success after a failed write Denis V. Lunev
2026-10-28 12:56 ` [Devel] [PATCH hci-8.1 0/2] dm-ploop, dm-qcow2: fix merge status shared by all devices Andrey Zhadchenko
2026-10-28 13:21 [Devel] [PATCH hci-8.1 v2 " Denis V. Lunev
2026-10-28 13:21 ` [Devel] [PATCH hci-8.1 2/2] dm-qcow2: fix a merge reporting success after a failed write Denis V. Lunev
2026-10-28 13:25   ` no-reply

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