Re: [PATCH v4] virtio-blk: clamp max_segments to virtqueue ring size

From: Jens Axboe

Date: Tue Nov 03 2026 - 09:41:39 EST



On Fri, 18 Sep 2026 15:51:20 +0200, Sergii Ushakov wrote:
> In virtblk_add_req(), each request consumes 2 extra descriptors (out_hdr
> and in_hdr) in addition to the data scatter-gather segments.
>
> When a hypervisor (e.g. QNX Hypervisor) advertises VIRTIO_BLK_F_SEG_MAX
> with seg_max = 1024 alongside a 1024-entry split ring (vring.num = 1024)
> and VIRTIO_RING_F_INDIRECT_DESC disabled, lim->max_segments is set to
> 1024. When the block layer submits requests with 1023 or 1024 data
> segments, total_sg reaches 1025 or 1026. This exceeds vring.num (1024),
> causing virtqueue_add_split() to return -ENOSPC and permanently wedge
> the blk-mq queue.
>
> [...]

Applied, thanks!

[1/1] virtio-blk: clamp max_segments to virtqueue ring size
commit: 603e66e8dd6adf2bad54bb27f4b690eacba3745e

Best regards,
--
Jens Axboe