OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den@openvz.org>
To: andrey.zhadchenko@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.1 1/2] dm-ploop: fix a failed merge failing every later merge on the host
Date: Tue, 27 Oct 2026 18:49:21 +0100	[thread overview]
Message-ID: <20261027174922.2254893-2-den@openvz.org> (raw)
In-Reply-To: <20261027174922.2254893-1-den@openvz.org>

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

ploop_process_merge_latest_snapshot() collects the status of its fake
merge pios in a function-local static. It is never reset and it is
shared by every ploop device, so once a single pio fails, every later
merge on any device stops after its first pio and returns that old
error, until the module is reloaded. A failure on one device also
aborts a merge running on another.

Keep the status on the stack. The pios carry a pointer to it, so the
function must not return while one of them is outstanding: every exit
already waits for service_pios to drain, and a BUG_ON after the wait
stops the kernel rather than let a late pio write into a dead stack
frame if that ever changes.

Fixes: 6ddad5a4d226 ("dm-ploop: Add ploop target driver")

Signed-off-by: Denis V. Lunev <den@openvz.org>

Feature: dm-ploop: ploop target driver
---
 drivers/md/dm-ploop-cmd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
index 5fa78e6cff9a..9084ca37f45b 100644
--- a/drivers/md/dm-ploop-cmd.c
+++ b/drivers/md/dm-ploop-cmd.c
@@ -671,7 +671,7 @@ static void service_pio_endio(struct pio *pio, void *data, blk_status_t status)
 
 static int ploop_process_merge_latest_snapshot(struct ploop *ploop)
 {
-	static blk_status_t service_status;
+	blk_status_t service_status = BLK_STS_OK;
 	struct bio_vec bvec = {0};
 	struct pio *pio;
 	int ret = 0;
@@ -711,6 +711,8 @@ static int ploop_process_merge_latest_snapshot(struct ploop *ploop)
 	}
 
 	wait_event(ploop->service_wq, !atomic_read(&ploop->service_pios));
+	/* The pios point at service_status on our stack */
+	BUG_ON(atomic_read(&ploop->service_pios));
 	if (!ret) {
 		spin_lock_irq(&ploop->err_status_lock);
 		ret = blk_status_to_errno(service_status);
-- 
2.53.0

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

  reply	other threads:[~2026-10-27 17:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Denis V. Lunev [this message]
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 1/2] dm-ploop: fix a failed merge failing every later merge on the host Denis V. Lunev
2026-10-28 13:25   ` 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=20261027174922.2254893-2-den@openvz.org \
    --to=den@openvz.org \
    --cc=andrey.zhadchenko@virtuozzo.com \
    --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