summaryrefslogtreecommitdiff
path: root/hw/block/virtio-blk.c
diff options
context:
space:
mode:
authorJulia Suvorova <jusual@redhat.com>2019-10-18 16:28:56 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2019-10-25 14:38:24 +0200
commit7bfde688fb1b05fa5f73d2498be959e59e1e1d57 (patch)
tree439f21e6654beb4c1b27ea1ae3f42cffe8601f39 /hw/block/virtio-blk.c
parent58560ad254fbda71d4daa6622d71683190070ee2 (diff)
downloadqemu-7bfde688fb1b05fa5f73d2498be959e59e1e1d57.zip
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 <jusual@redhat.com> Message-Id: <20191018142856.31870-1-jusual@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'hw/block/virtio-blk.c')
-rw-r--r--hw/block/virtio-blk.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index ed2ddebd2b..14e9f85b8b 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -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);