[Devel] [PATCH VZ10 5/7] drivers/vhost/blk: do not complete requests with failed status write
Andrey Zhadchenko
andrey.zhadchenko at virtuozzo.com
Mon Jun 15 17:55:33 MSK 2026
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>
---
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 029e92b3105bc..34edfe0934598 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);
}
--
2.43.5
More information about the Devel
mailing list