[Devel] [PATCH VZ10 3/7] drivers/vhost/blk: improve request re-processing
Andrey Zhadchenko
andrey.zhadchenko at virtuozzo.com
Mon Jun 15 17:55:31 MSK 2026
Handle failed request processing with extra care:
- If we got ENOMEM or EAGAIN, reverse vq head with
vhost_discard_vq_desc() and try again
- On any other error, signal error and wait for next kick just
like vhost-net or vhost-scsi. After all, we can't do anything with
faulty guest request anyway.
https://virtuozzo.atlassian.net/browse/VSTOR-134034
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
drivers/vhost/blk.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/vhost/blk.c b/drivers/vhost/blk.c
index 7e33a4f30165d..ef0f6f77bfada 100644
--- a/drivers/vhost/blk.c
+++ b/drivers/vhost/blk.c
@@ -540,7 +540,6 @@ static void vhost_blk_handle_guest_kick(struct vhost_work *work)
ret = move_iovec(vq->iov, hdr_iovec, sizeof(hdr), in + out, ARRAY_SIZE(hdr_iovec));
if (ret < 0) {
vhostblk_vq_err(blk, vq, "virtio_blk_hdr (head %d) is too split!", head);
- vhost_discard_vq_desc(vq, 1);
break;
}
@@ -553,8 +552,13 @@ static void vhost_blk_handle_guest_kick(struct vhost_work *work)
break;
}
- if (vhost_blk_req_handle(vq, &hdr, head, out + in) < 0) {
+ ret = vhost_blk_req_handle(vq, &hdr, head, out + in);
+ if (ret == -EAGAIN || ret == -ENOMEM) {
vhost_discard_vq_desc(vq, 1);
+ continue;
+ } else if (ret < 0) {
+ vhostblk_vq_err(blk, vq, "Failed to process guest request (head %d) with %d",
+ head, ret);
break;
}
--
2.43.5
More information about the Devel
mailing list