From: Fiona Ebner <f.ebner@proxmox.com>
To: "Denis V. Lunev" <den@openvz.org>, qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
qemu-stable@nongnu.org
Subject: Re: [PATCH] block: fix bdrv_next() skipping monitor-owned nodes
Date: Tue, 1 Sep 2026 14:23:13 +0200 [thread overview]
Message-ID: <05df98ca-e5d7-4cb2-99d2-74a1a276f58a@proxmox.com> (raw)
In-Reply-To: <20260828222005.2888213-1-den@openvz.org>
Hi Denis,
Am 29.08.26 um 12:20 AM schrieb Denis V. Lunev:
> From: Denis V. Lunev <den@openvz.org>
>
> it->bs is the cursor into monitor_bdrv_states for the second phase of
> bdrv_next(), so it has to be NULL when that phase starts. Commit
> f6d38c9f6d made the first phase store the node it returns there, to
> unreference the right one when the graph changes underneath. The cursor
> is now left pointing at the last BlockBackend root, so the second phase
> resumes from there instead of from the head of the list and never
> returns a node added before it.
>
> A skipped node drops out of the vm_stop and migration handover paths:
> not flushed, not inactivated, not snapshotted. bdrv_inactivate_all()
> still reports success, so the node keeps its image lock and the
> migration target cannot open the image. Only detached nodes are hit in
> practice, as these callers also recurse into children.
>
> Reset the cursor when the second phase starts. old_bs is taken at the
> top of the function, so f6d38c9f6d keeps working.
>
> Fixes: f6d38c9f6d ("block-backend: fix edge case in bdrv_next() where BDS associated to BB changes")
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> Cc: Fiona Ebner <f.ebner@proxmox.com>
> Cc: Kevin Wolf <kwolf@redhat.com>
thank you for the fix!
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Fiona Ebner <f.ebner@proxmox.com>
Should also go into stable I suppose?
> ---
>
> Notes:
> The iterator was correct from its introduction in 2016 until 2024:
> it->bs was written only by the second phase, and the node to unreference
> came from the BlockBackend instead.
>
> f6d38c9f6d's own reproducer does not fire for me, 240 runs across 8
> timings, even with its fix reverted. Tried hard.
The reproducer has a very short time window. I'm still able to trigger
an assertion failure with commit f6d38c9f6d reverted, by putting in some
'query-version' commands in between the 'block-stream' and 'quit'
commands, and running the script in a loop, e.g.:
[I] root@pve9a1 ~# cat ~/block-stream.sh
#!/bin/bash
rm -f /tmp/backing.qcow2
rm -f /tmp/top.qcow2
./qemu-img create /tmp/backing.qcow2 -f qcow2 64M
./qemu-io -c "write -P42 0x0 0x1" /tmp/backing.qcow2
./qemu-img create /tmp/top.qcow2 -f qcow2 64M -b /tmp/backing.qcow2 -F qcow2
./qemu-system-x86_64 --qmp stdio \
--blockdev
qcow2,node-name=node0,file.driver=file,file.filename=/tmp/top.qcow2 \
<<EOF
{"execute": "qmp_capabilities"}
{"execute": "block-stream", "arguments": { "job-id": "stream0",
"device": "node0" } }
{"execute": "query-version"}
{"execute": "query-version"}
{"execute": "query-version"}
{"execute": "query-version"}
{"execute": "query-version"}
{"execute": "query-version"}
{"execute": "query-version"}
{"execute": "query-version"}
{"execute": "query-version"}
{"execute": "quit"}
EOF
Best Regards,
Fiona
next prev parent reply other threads:[~2026-09-01 12:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 22:20 [PATCH] block: fix bdrv_next() skipping monitor-owned nodes Denis V. Lunev
2026-09-01 12:23 ` Fiona Ebner [this message]
2026-09-01 12:50 ` Denis V. Lunev
2026-10-02 10:07 ` Erik Fastermann
2026-09-07 10:45 ` Denis V. Lunev
2026-09-15 11:43 ` Denis V. Lunev
2026-09-21 19:40 ` Denis V. Lunev
2026-09-22 15:23 ` Kevin Wolf
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=05df98ca-e5d7-4cb2-99d2-74a1a276f58a@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=den@openvz.org \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.