virtio-blk: Add blk_drain() to virtio_blk_device_unrealize()
PATCH 1/1 virtio-blk: Add blk_drain() to virtio_blk_device_unrealize()
QEMU does not wait for completed I/O requests, assuming that the guest driver will reset the device before calling unrealize(). This does not happen on Windows, and QEMU crashes in virtio_notify(), getting the result of a completed I/O request on hot-unplugged device.
Signed-off-by Julia Suvorova <[email protected]>
--- hw/block/virtio-blk.c | 1 + 1 file changed, 1 insertion(+)
hw/block/virtio-blk.c +1 -0
@@ -1207,6 +1207,7 @@ static void virtio_blk_device_unrealize(DeviceState *dev, Error **errp)VirtIODevice *vdev =VIRTIO_DEVICE (dev);VirtIOBlock *s =VIRTIO_BLK (dev); +blk_drain (s->blk);virtio_blk_data_plane_destroy (s->dataplane); s->dataplane =NULL ;qemu_del_vm_change_state_handler (s->change);
Signature · 1 line
2.21.0
Stefan Hajnoczi
AppliedQuoted 9 lines · Julia Suvorova
QEMU does not wait for completed I/O requests, assuming that the guest driver will reset the device before calling
unrealize(). This does not happen on Windows, and QEMU crashes invirtio_notify(), getting the result of a completed I/O request on hot-unplugged device.Signed-off-by Julia Suvorova <[email protected]>--- hw/block/virtio-blk.c | 1 + 1 file changed, 1 insertion(+)
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan