From: no-reply@sashiko.virtuozzo.com
To: Alexander Ivanov <alexander.ivanov@virtuozzo.com>,
andrey.zhadchenko@virtuozzo.com
Cc: andrey.drobyshev@virtuozzo.com, svt-core@virtuozzo.com
Subject: Re: [PATCH hci-8.1 2/2] vhost-blk: pause the VM on an IO_ERROR uevent from dm-qcow2 #VSTOR-152175
Date: Tue, 17 Nov 2026 11:05:47 +0000 [thread overview]
Message-ID: <010701a1e92f340f-afcb6aa6-92e1-4d58-9eb1-5f0ee108d23c-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261117105003.3082044-3-alexander.ivanov@virtuozzo.com>
Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [Medium] vhost-blk: IO_ERROR outside RUNNING skips io_error_held and
migration blocker
- [Low] vhost-blk: realize rejects only stop policy without ueventfd,
not enospc
- [Low] vhost-blk: runstate_is_running() guard lets duplicate
BLOCK_IO_ERROR events through
- [Low] vhost-blk: ENOBUFS recovery in uevent_read() ignores dropped
IO_ERROR events
--
commit 678e0f871c6d292d376eb1ea266d4ee9fc2f8511
Author: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
vhost-blk: pause the VM on an IO_ERROR uevent from dm-qcow2 #VSTOR-152175
The patch parses the IO_ERROR change uevent from dm-qcow2 on the uevent
socket. If the werror or rerror policy asks for it, QEMU emits
BLOCK_IO_ERROR and stops the VM with RUN_STATE_IO_ERROR. It also blocks
migration while requests are held, fails pre_save in that state, and
rejects the stop policy when no ueventfd is given.
> diff --git a/hw/block/vhost-blk.c b/hw/block/vhost-blk.c
> index 354111a1b41a..6775a561eabb 100644
> --- a/hw/block/vhost-blk.c
> +++ b/hw/block/vhost-blk.c
[ ... ]
> +static void vhost_blk_io_error(VHostBlk *s, bool is_read, int error)
> +{
> + DeviceState *dev = DEVICE(s);
> + DeviceState *proxy = dev->parent_bus ? dev->parent_bus->parent : NULL;
> + BlockdevOnError on_err = is_read ? s->conf.conf.rerror
> + : s->conf.conf.werror;
> + g_autofree char *path = NULL;
> +
> + if (on_err != BLOCKDEV_ON_ERROR_STOP &&
> + (on_err != BLOCKDEV_ON_ERROR_ENOSPC || error != ENOSPC)) {
> + return;
> + }
> +
> + /* dm-qcow2 repeats the event on every failed retry of a held request */
> + if (!runstate_is_running()) {
> + return;
> + }
> +
> + path = object_get_canonical_path(OBJECT(dev));
> +
> + s->io_error_held = true;
> + if (!s->io_error_blocker) {
[Severity: Medium]
Does this early return drop the first IO_ERROR event when the VM is in
PAUSED, FINISH_MIGRATE or SAVE_VM?
vhost_blk_vm_state() has already run vhost_blk_stop() and
vhost_blk_reset() in those states. A request that fails afterwards can
be held by dm-qcow2, but its event returns here before io_error_held is
set or the blocker is added. vhost_blk_pre_save() then returns 0, so
savevm or migration can complete while dm-qcow2 still holds a request
the guest has submitted.
The comment only justifies skipping repeats once the VM is already in
IO_ERROR. Would it work to set io_error_held and add the blocker before
this check, and skip only the vmstop and the event here?
[Severity: Low]
Does this check dedupe anything inside the drain loop of
vhost_blk_uevent_read()? qemu_system_vmstop_request() only records the
request and wakes the main loop. The run state stays RUNNING until the
main loop runs vm_stop(). Several queued IO_ERROR datagrams read in one
pass all get through, so management sees duplicate BLOCK_IO_ERROR events
and repeated vmstop requests. The comment and commit message say repeats
are ignored, which only holds after the stop has been processed.
Checking s->io_error_held here would close the window.
[ ... ]
> @@ -373,11 +431,18 @@ static void vhost_blk_uevent_read(void *opaque)
> field += field_len + 1;
> }
>
> - if (action_change && subsystem_block && resize &&
> - event_major == major(s->backend_rdev) &&
> - event_minor == minor(s->backend_rdev)) {
> + if (!action_change || !subsystem_block ||
> + event_major != major(s->backend_rdev) ||
> + event_minor != minor(s->backend_rdev)) {
> + continue;
> + }
> +
> + if (resize) {
> qemu_bh_schedule(s->resize_bh);
> }
> + if (io_error) {
> + vhost_blk_io_error(s, io_error_read, io_error_errno);
> + }
> }
> }
[Severity: Low]
Is a lost IO_ERROR event recoverable? The ENOBUFS branch earlier in this
function only schedules resize_bh, which re-reads the capacity. If the
netlink socket overruns and the IO_ERROR datagram is among those
dropped, QEMU never stops the VM and never emits BLOCK_IO_ERROR. The
guest keeps running with a request held in the kernel, and nothing
re-queries that state.
[ ... ]
> @@ -635,6 +700,14 @@ static void vhost_blk_device_realize(DeviceState *dev, Error **errp)
> return;
> }
>
> + if (!conf->ueventfd &&
> + (conf->conf.werror == BLOCKDEV_ON_ERROR_STOP ||
> + conf->conf.rerror == BLOCKDEV_ON_ERROR_STOP)) {
> + error_setg(errp, "vhost-blk: 'stop' error policy requires the "
> + "'ueventfd' property");
> + return;
> + }
[Severity: Low]
Should enospc also require ueventfd here? The commit message says the
enospc or stop policy is affected, but only stop is checked. The default
werror (auto) is mapped to enospc earlier in realize. Without ueventfd, a
held ENOSPC write never reaches vhost_blk_io_error(), so the VM keeps
running with the request stuck. Either check werror == ENOSPC as well or
document the limitation.
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261117105003.3082044-1-alexander.ivanov@virtuozzo.com?part=2
next prev parent reply other threads:[~2026-11-17 11:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 10:50 [PATCH hci-8.1 0/2] vhost-blk: support the werror/rerror policies Alexander Ivanov
2026-11-17 10:50 ` [PATCH hci-8.1 1/2] vhost-blk: add the werror and rerror properties #VSTOR-152175 Alexander Ivanov
2026-11-17 11:03 ` no-reply
2026-11-17 18:12 ` Andrey Drobyshev
2026-11-17 10:50 ` [PATCH hci-8.1 2/2] vhost-blk: pause the VM on an IO_ERROR uevent from dm-qcow2 #VSTOR-152175 Alexander Ivanov
2026-11-17 11:05 ` no-reply [this message]
2026-11-17 18:12 ` Andrey Drobyshev
2026-11-17 10:59 ` [PATCH hci-8.1 0/2] vhost-blk: support the werror/rerror policies Andrey Drobyshev
2026-11-17 18:14 ` Denis V. Lunev
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=010701a1e92f340f-afcb6aa6-92e1-4d58-9eb1-5f0ee108d23c-000000@eu-central-1.amazonses.com \
--to=no-reply@sashiko.virtuozzo.com \
--cc=alexander.ivanov@virtuozzo.com \
--cc=andrey.drobyshev@virtuozzo.com \
--cc=andrey.zhadchenko@virtuozzo.com \
--cc=svt-core@virtuozzo.com \
/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.