> When the owner is killed, vhost_worker_killed() detaches the worker
> from the vqs. A bio completing after that fails to queue the
> completion work, so its request stays on llhead and is never removed
> from req_inflight. vhost_blk_flush() on release then waits forever
> and the process is stuck in D state. Any kill of a VM with I/O in
> flight can hit this.
> 
> If the work cannot be queued, drop the completed requests right in
> the bio end_io: forget them without writing a status, as there is no
> guest left to see it. llist_del_all() makes sure a request is dropped
> once even if it races with the last run of the host kick handler.
> forget_request() can now run in irq context, so take flush_lock with
> interrupts disabled. The end_io may run in atomic context and the
> request buffers may be vmalloc'ed, so free them on release instead:
> a dropped request is the one left with ->inflight set.
> 
> Once a request is on llhead, a concurrent consumer may forget it and
> let release free the request array and blk while the end_io is still
> using blk_vq. Keep the end_io tail in an RCU read-side section and
> wait for a grace period before freeing the requests. The same window
> existed before with the host kick handler as the consumer.
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-152175
> 
> Fixes: c57a98d65796 ("drivers/vhost: vhost-blk accelerator for virtio-blk 
> guests")
> Feature: vhost-blk: in-kernel accelerator for virtio-blk guests
> Signed-off-by: Alexander Ivanov <[email protected]>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review ยท 
https://sashiko.vzint.dev/#/patchset/[email protected]?part=9


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

Reply via email to