OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
To: andrey.zhadchenko@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.1 v3 0/9] dm-qcow2: support the werror/rerror policies for vhost-blk disks
Date: Tue, 17 Nov 2026 11:43:20 +0100	[thread overview]
Message-ID: <20261117104329.3079812-1-alexander.ivanov@virtuozzo.com> (raw)

QEMU disks have the werror/rerror policies: on an I/O error either
report it to the guest, or pause the VM and retry the request on
resume. A vhost-blk disk completes requests to the guest from the
kernel, so QEMU never sees the error. This series lets dm-qcow2 hold
a failed request according to the policy, tell QEMU about it, and
retry or fail it on request from userspace.

Patches 1-2 fix the existing ENOSPC delay: a use-after-free of the
event work and timer on destroy, and a suspend stalled by a request
delayed while the timer callback runs.

Patches 3-4 rename the ENOSPC delay list to a held request list and
arm the retry timer once per hold, so new failures do not postpone
the retry of the held requests forever.

Patch 5 sends an IO_ERROR change uevent when requests get held, as
QEMU cannot wait for dm events without CAP_SYS_ADMIN.

Patch 6 adds the resubmit and fail_held messages, so libvirt can
retry the held requests on VM resume and drop them on VM destroy.

Patch 7 adds the error_policy=<read>,<write> table argument with the
report, enospc and stop policies. The default keeps the current
behaviour for writes.

Patch 8 requeues held requests to the dm queue on a noflush suspend,
so a table reload or a snapshot of a VM paused on an I/O error does
not deliver the error to the guest. ploop suspends with flush for a
snapshot and a resize, so this needs the ploop.ovz change below.

Patch 9 fixes a vhost-blk hang on release when the vhost worker was
killed with I/O in flight, which a VM destroyed while its requests
are held runs into.

How the VM is paused: QEMU stops the VM with RUN_STATE_IO_ERROR on
the uevent. vhost-blk keeps running in that state, so the held
requests survive the pause and libvirt resubmits them before cont.
Any other pause stops vhost-blk, which waits for all in-flight
requests with the BQL held. So libvirt sends fail_held before virsh
suspend, save, snapshot and a migration of a running VM, and the
guest gets EIO for the requests held at that moment. vhost-blk
cannot keep them across a stop the way QEMU keeps its retry list.
QEMU blocks migration and savevm while the VM is paused on a held
request.

Userspace series, all for VSTOR-152175:

qemu.vzs, "[PATCH hci-8.1 0/2] vhost-blk: support the werror/rerror
policies":
  vhost-blk: add the werror and rerror properties
  vhost-blk: pause the VM on an IO_ERROR uevent from dm-qcow2

libvirt.ovz:
  qemu: pass the error policy of vhost-blk disks to dm-qcow2
  qemu: resubmit held vhost-blk requests before resuming the VM
  qemu: fail held vhost-blk requests before killing QEMU
  qemu: pass IO_ERROR uevents to vhost-blk
  conf: allow error_policy for vhostblk disks
  qemu: fail held vhost-blk requests before pausing the VM
  qemu: fail held vhost-blk requests before migrating a running VM

ploop.ovz:
  lib: add read/write error policies for dm-qcow2 devices
    (passes error_policy on mount and keeps the policy of the loaded
    table on every reload, snapshot, merge and replace included)
  lib: add ploop_resubmit_held() and ploop_fail_held()
  ploop: add the -e error policy option to ploop mount
  lib: suspend unpartitioned dm-qcow2 devices with noflush
  and tests for both

v3:
- cover letter: describe how userspace pauses a VM with held
  requests, list the qemu.vzs, libvirt.ovz and ploop.ovz changes the
  series needs, note the ploop dependency of patch 8

v2:
- patches 1, 2, 4, 9: add Fixes tags
- patch 5: state that held ENOSPC reads are reported too, and that
  every dm-qcow2 device whose storage stays full now gets a uevent on
  each retry
- patch 7: drop the misleading "whatever the error" from the message
- patch 8: note that ploop needs the ploop.ovz change "lib: suspend
  unpartitioned dm-qcow2 devices with noflush" to get the requeue on
  a snapshot or resize

https://virtuozzo.atlassian.net/browse/VSTOR-152175

Alexander Ivanov (9):
  drivers/md/dm-qcow2: cancel the event work and ENOSPC timer in the
    destructor
  drivers/md/dm-qcow2: always resubmit delayed ENOSPC requests in
    presuspend
  drivers/md/dm-qcow2: rename the ENOSPC delay list to a held request
    list
  drivers/md/dm-qcow2: arm the hold timer only for the first held
    request
  drivers/md/dm-qcow2: report held requests with an IO_ERROR uevent
  drivers/md/dm-qcow2: add the resubmit and fail_held messages
  drivers/md/dm-qcow2: add the error_policy table argument
  drivers/md/dm-qcow2: requeue held requests on a noflush suspend
  drivers/vhost/blk: fix a hang on release after the vhost worker is
    killed

 drivers/md/dm-push-backup.c  |   2 +-
 drivers/md/dm-qcow2-cmd.c    |  32 +++++++++-
 drivers/md/dm-qcow2-map.c    | 110 +++++++++++++++++++++++++++++------
 drivers/md/dm-qcow2-target.c | 104 ++++++++++++++++++++++++++++-----
 drivers/md/dm-qcow2.h        |  26 +++++++--
 drivers/md/dm-rq.c           |   4 +-
 drivers/md/dm-rq.h           |   2 +-
 drivers/vhost/blk.c          |  52 ++++++++++++-----
 8 files changed, 274 insertions(+), 58 deletions(-)

-- 
2.53.0

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

             reply	other threads:[~2026-11-17 10:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 10:43 Alexander Ivanov [this message]
2026-11-17 10:43 ` [Devel] [PATCH hci-8.1 v3 1/9] drivers/md/dm-qcow2: cancel the event work and ENOSPC timer in the destructor Alexander Ivanov
2026-11-17 10:52   ` no-reply
2026-11-17 10:43 ` [Devel] [PATCH hci-8.1 v3 2/9] drivers/md/dm-qcow2: always resubmit delayed ENOSPC requests in presuspend Alexander Ivanov
2026-11-17 10:50   ` no-reply
2026-11-17 10:43 ` [Devel] [PATCH hci-8.1 v3 3/9] drivers/md/dm-qcow2: rename the ENOSPC delay list to a held request list Alexander Ivanov
2026-11-17 10:51   ` no-reply
2026-11-17 10:43 ` [Devel] [PATCH hci-8.1 v3 4/9] drivers/md/dm-qcow2: arm the hold timer only for the first held request Alexander Ivanov
2026-11-17 10:52   ` no-reply
2026-11-17 10:43 ` [Devel] [PATCH hci-8.1 v3 5/9] drivers/md/dm-qcow2: report held requests with an IO_ERROR uevent Alexander Ivanov
2026-11-17 10:53   ` no-reply
2026-11-17 10:43 ` [Devel] [PATCH hci-8.1 v3 6/9] drivers/md/dm-qcow2: add the resubmit and fail_held messages Alexander Ivanov
2026-11-17 10:54   ` no-reply
2026-11-17 10:43 ` [Devel] [PATCH hci-8.1 v3 7/9] drivers/md/dm-qcow2: add the error_policy table argument Alexander Ivanov
2026-11-17 10:56   ` no-reply
2026-11-17 10:43 ` [Devel] [PATCH hci-8.1 v3 8/9] drivers/md/dm-qcow2: requeue held requests on a noflush suspend Alexander Ivanov
2026-11-17 10:57   ` no-reply
2026-11-17 10:43 ` [Devel] [PATCH hci-8.1 v3 9/9] drivers/vhost/blk: fix a hang on release after the vhost worker is killed Alexander Ivanov
2026-11-17 11:01   ` no-reply
2026-11-17 11:25   ` Konstantin Khorenko
2026-11-17 11:25 ` [Devel] [PATCH hci-8.1 v3 0/9] dm-qcow2: support the werror/rerror policies for vhost-blk disks Konstantin Khorenko

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=20261117104329.3079812-1-alexander.ivanov@virtuozzo.com \
    --to=alexander.ivanov@virtuozzo.com \
    --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