[PATCH v1 0/1] virtio-block: switch to blk_get_max_hw_transfer

Or Ozeri posted 1 patch 4 years, 2 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20211209092815.778066-1-oro@il.ibm.com
Maintainers: Hanna Reitz <hreitz@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>
hw/block/virtio-blk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v1 0/1] virtio-block: switch to blk_get_max_hw_transfer
Posted by Or Ozeri 4 years, 2 months ago
Since moving to qemu 6.1.0 we've been seeing disk failures inside a qemu guest VM.
This happened when using if=virtio on a host /dev/nbdX device.
Binary searching on qemu commit history, I found these errors start on this commit:

Commit 18473467
file-posix: try BLKSECTGET on block devices too, do not round to power of 2

The above commit switched posix block device limits (including host /dev/nbdX devices)
to query limits from /sys/dev/block/..., instead of using predefined limits.

The scsi-generic driver was changed to use the queried limits,
whereas the virtio-blk driver was only the queried max_iov,
but still using the predefined max_transfer, which is unlimited in qemu.

For NBD devices, max_iov is unlimited by the kernel nbd driver.
As as consequence, the virtio-blk merged requests over the limit of our host /dev/nbdX device,
which apparently caused the guest disk errors.

The solution that worked for me was to change the virtio-blk driver to use the max_transfer
limit queried from the posix host device (given by blk_get_max_hw_transfer).

Or Ozeri (1):
  virtio-block: switch to blk_get_max_hw_transfer

 hw/block/virtio-blk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.25.1