virtio/blk: sync I/O on reset

Ensure that all requests are complete when resetting a virtqueue, by
draining the AIO queue after stopping the submission thread.

Signed-off-by: Jean-Philippe Brucker <>
Signed-off-by: Will Deacon <>
diff --git a/virtio/blk.c b/virtio/blk.c
index 6e7a1ee..50db6f5 100644
--- a/virtio/blk.c
+++ b/virtio/blk.c
@@ -248,6 +248,8 @@
 	pthread_join(bdev->io_thread, NULL);
+	disk_image__wait(bdev->disk);
 static int notify_vq(struct kvm *kvm, void *dev, u32 vq)