[Devel] [PATCH RHEL10 COMMIT] drivers/vhost/blk: do not complete requests with failed status write
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Jun 19 19:36:07 MSK 2026
The commit is pushed to "branch-rh10-6.12.0-211.16.1.12.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-211.16.1.12.4.vz10
------>
commit 12226fd33eff6dd957deca7d8c7343d3d8fc9a10
Author: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
Date: Fri Jun 19 16:33:11 2026 +0300
drivers/vhost/blk: do not complete requests with failed status write
Given that we failed to write into status memory, it's content is
undefined. So completing the request is kind of sketchy.
Just do like vhost-net and vhost-scsi and do not report this
request completion.
Do not forget to properly forget the request though.
https://virtuozzo.atlassian.net/browse/VSTOR-134034
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
======
Patchset description:
vhost-blk: handling of failing requests
This series mainly addresses the handling of failing requests.
Previously the driver will always retry all requests failed at
processing and will always complete the requests if they are
past bio submission point.
Using vhost-net and vhost-scsi as a model, we adopt the following
approach:
- requests failed at processing phase with ENOMEM/EAGAIN are re-tried
- requests failed at processing phase with other errors are not
reported completed and are not processed further. It is higly likely
they are just incorrect
- requests failed at status write after the completion are not
reported completed
This may sometime lead to guests stalling, but the alternatives are
always worse.
Also the patchset improves logging and adds a few sanity checks.
Feature: vhost-blk: in-kernel accelerator for virtio-blk guests
Reviewed-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
drivers/vhost/blk.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/vhost/blk.c b/drivers/vhost/blk.c
index ef39ab92eee11..cdc82a8961870 100644
--- a/drivers/vhost/blk.c
+++ b/drivers/vhost/blk.c
@@ -594,11 +594,12 @@ static void vhost_blk_handle_host_kick(struct vhost_work *work)
vhost_blk_req_cleanup(req);
status = req->bio_err == 0 ? VIRTIO_BLK_S_OK : VIRTIO_BLK_S_IOERR;
- if (vhost_blk_set_status(req, status))
+ if (vhost_blk_set_status(req, status)) {
vhostblk_vq_err(blk, vq, "Failed to write status");
-
- vhost_add_used(vq, req->head, req->len);
- added = true;
+ } else {
+ vhost_add_used(vq, req->head, req->len);
+ added = true;
+ }
forget_request(req);
}
More information about the Devel
mailing list