[Devel] [PATCH hci-8.1] drivers/vhost/blk: drop completed requests when the vq has no worker
no-reply at sashiko.virtuozzo.com
no-reply at sashiko.virtuozzo.com
Wed Nov 18 19:53:34 MSK 2026
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] vhost/blk: bug-fix commit lacks a Fixes: trailer
- [Low] vhost-blk: vhost_blk_drop_req() leaves req->inflight set on
dropped requests
--
commit ee94643eb92be4e55fe58e2e2a5d609d57dc2319
Author: Alexander Ivanov <alexander.ivanov at virtuozzo.com>
drivers/vhost/blk: drop completed requests when the vq has no worker
When vhost_blk_req_done() finds that the vq has no worker, it now frees the request from a work item on the system workqueue. The patch also holds an extra req_inflight[] reference while the callback uses blk, and makes flush_lock irq-safe.
> drivers/vhost/blk: drop completed requests when the vq has no worker
>
> vhost_blk_req_done() ignores the return value of vhost_vq_work_queue().
> Once a vhost_task worker is killed, vhost_worker_killed() clears
> vq->worker, so a request completing after that stays on llhead forever:
> its bio, iov and bounce buffer leak and req_inflight[] is never
> decremented. vhost_blk_flush() then waits for it with no timeout, which
> hangs release, VHOST_RESET_OWNER and VHOST_SET_FEATURES.
>
> Free such requests from a work item on the system workqueue.
> [ ... ]
>
> Signed-off-by: Alexander Ivanov <alexander.ivanov at virtuozzo.com>
[Severity: Low]
This looks like a bug fix for a long-standing ignored return value in
vhost_blk_req_done(). Should this include:
Fixes: c57a98d65796 ("drivers/vhost: vhost-blk accelerator for virtio-blk guests")
If 386033c1c98d ("drivers/vhost/blk: fix vhost_blk_req_done() softirq
handling") is judged the real introducer, it could point there instead.
> diff --git a/drivers/vhost/blk.c b/drivers/vhost/blk.c
> index b95358cdf3bc0..cb966e52acdd0 100644
> --- a/drivers/vhost/blk.c
> +++ b/drivers/vhost/blk.c
[ ... ]
> @@ -394,22 +404,45 @@ static inline void vhost_blk_bio_send(struct vhost_blk_req *req)
[ ... ]
> +static void vhost_blk_drop_req(struct vhost_blk_req *req)
> +{
> + vhost_blk_req_cleanup(req);
> + forget_request(req);
> +}
[Severity: Low]
Should vhost_blk_drop_req() clear req->inflight before forget_request(),
the way vhost_blk_handle_host_kick() does on normal completion?
A dropped request stays marked inflight in blk_vq->req[head]. If the
worker was killed, a new one is attached with VHOST_NEW_WORKER plus
VHOST_ATTACH_VRING_WORKER, and the guest then reuses that head,
vhost_blk_req_handle() fails with -EBUSY ("Guest reused in-flight head")
and the vq is stopped.
The commit message also does not say that dropped requests are never
completed to the guest.
Carry the trailer below into the next revision and Sashiko will not review this patch again.
Reviewed-by: Sashiko <no-reply at sashiko.virtuozzo.com>
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261118164637.3464286-1-alexander.ivanov@virtuozzo.com?part=1
More information about the Devel
mailing list