[Devel] [PATCH hci-8.2 v2 4/4] drivers/vhost/blk: add the VHOST_BLK_RESUBMIT ioctl
Alexander Ivanov
alexander.ivanov at virtuozzo.com
Tue Dec 1 11:23:52 MSK 2026
>> +
>> +/*
>> + * Resubmit requests by vq and head, as if they were just taken from the avail
>> + * ring. Only heads read with VHOST_BLK_GET_HELD_REQS after the last stop may be
>> + * passed: the kernel does not track them. A head passed again after its request
>> + * completed, still owned by the guest, or reused by the guest since the backend
>> + * was set, is completed twice, or fails with -EBUSY while still in flight.
>> + * error and type are ignored, reserved must be 0. On error, nr is set to the
>> + * index of the entry that failed; the entries before it were resubmitted.
>> + * Fails with -ENODEV until the backend is set.
>> + */
>> +#define VHOST_BLK_RESUBMIT _IOWR(VHOST_VIRTIO, 0xFA, \
>> + struct vhost_blk_held_reqs)
>> #endif
> [Severity: Low]
> As reported by Konstantin Khorenko on v1 [1], this comment does not say
> what userspace should do with the entry that failed. Which errors are
> transient, so the same entry can be retried? Which are permanent, so it
> should be skipped?
>
> vhost_blk_resubmit() stops at the first non-zero return. That can be
> -ENOMEM or -EAGAIN from the descriptor parsing and request submission,
> -EINTR from the loop, or -EFAULT, -EINVAL, -EBUSY or -ENODEV from
> vhost_blk_resubmit_one(). Without a documented rule, one bad entry can
> block every held request after it, and userspace cannot tell whether to
> retry, skip or give up.
>
> [1] https://lore.kernel.org/r/179578030084.10258.14556640974201502480.b4-review@b4
>
Agreed. v4 documents it: retry the same entry on -ENOMEM, stop on
-ENODEV or -EINTR, otherwise go on from nr + 1. -EAGAIN cannot come
back here: the backend is checked under vq->mutex, and there is no
IOTLB.
More information about the Devel
mailing list