@samitouri / QOSamiQemu / commits / 639dcd5870

vhost-user-blk: do not force VIRTIO_BLK_F_SIZE_MAX

vhost_user_blk_get_features() unconditionally advertises VIRTIO_BLK_F_SIZE_MAX regardless of what the backend reports in its config. The built-in QSD vhost-user-blk backend sets size_max=0, creating a contradictory state where the feature bit tells the guest that size_max is valid but the value is zero. The in-process virtio-blk device does not advertise VIRTIO_BLK_F_SIZE_MAX (it also sets size_max=0 in config), so guests never see this contradiction with native virtio-blk. Linux tolerates size_max=0 because blk_validate_limits() silently corrects max_segment_size=0 to BLK_MAX_SEGMENT_SIZE (65536). Windows viostor, however, trusts the feature bit and uses the raw size_max=0 in its scatter-gather calculations, producing zero-length segments that hang I/O. The disk appears empty to Windows (no GPT, no partitions), causing INACCESSIBLE_BOOT_DEVICE. Stop force-adding VIRTIO_BLK_F_SIZE_MAX in the frontend. The feature remains in user_feature_bits[], so backends that properly advertise it with a valid config value will still work. Signed-off-by: Max Makarov <maxpain@linux.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20260331134721.96047-1-maxpain@linux.com>

Max Makarov committed Mar 31, 2026 at 16:47 UTC 639dcd58707951cb88a0dddcb5027780c53d49dd
1 file changed -1
hw/block/vhost-user-blk.c
-1
@@ -283,7 +283,6 @@ static uint64_t vhost_user_blk_get_features(VirtIODevice *vdev,
283 VHostUserBlk *s = VHOST_USER_BLK(vdev);
284
285 /* Turn on pre-defined features */
286 - virtio_add_feature(&features, VIRTIO_BLK_F_SIZE_MAX);
286 virtio_add_feature(&features, VIRTIO_BLK_F_SEG_MAX);
287 virtio_add_feature(&features, VIRTIO_BLK_F_GEOMETRY);
288 virtio_add_feature(&features, VIRTIO_BLK_F_TOPOLOGY);