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 <[email protected]>
---
 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);
        }
-- 
2.43.5

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to