[Devel] [PATCH hci-8.2 3/4] drivers/vhost/blk: hold requests failed with ENOSPC
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Nov 27 14:51:40 MSK 2026
Items 1, 2 and 3 of the cover letter reply; item 6 is about this patch too.
On Fri, 27 Nov 2026 12:16:02 +0100, Alexander Ivanov wrote:
> A held request is not counted as inflight, so that unsetting the
> backend does not wait for it. Its head stays taken, so a guest reusing
> it gets the same error as for a head in flight.
Item 1. Only until the backend is unset: vhost_blk_drop_backend() frees
blk->vqs[i].req, and vhost_blk_setup_vqs() allocates it zeroed, so
after the stop and start QEMU does before VHOST_BLK_RESUBMIT the head
is free. A guest that reuses it then gets it accepted, and the later
RESUBMIT of that head fails with -EBUSY or completes it twice. Only
that guest is hurt, so saying it is enough, but the sentence and the
uapi comment must not promise more.
> + held = kvcalloc(nr, sizeof(*held), GFP_KERNEL);
> + if (!held)
> + return -ENOMEM;
> + vhost_blk_reset_held(blk, held);
Item 2. The old list is dropped here, before the vq setup below can
still fail. QEMU needs that list to resubmit, so a failed
VHOST_BLK_SET_BACKEND loses the held heads and the guest waits for
them forever. Swap the new list in once the setup succeeded, and drop
"A failing one may empty it too" from the uapi comment.
> err = blk_status_to_errno(bio->bi_status);
> if (err)
> req->bio_err = err;
Item 3. A request split into several bios keeps the error of the bio
that completes last. One bio failing with EIO and another with ENOSPC
make the request held or failed depending on completion order, and a
held EIO comes back on every resume. Keep the first error, or let any
error other than ENOSPC win.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
More information about the Devel
mailing list