@@ -258,9 +258,16 @@ void virtio_blk_data_plane_stop(VirtIODevice *vdev)
virtio_queue_aio_set_host_notifier_handler(vq, s->ctx, NULL);
}
- /* Drain and switch bs back to the QEMU main loop */
+ /* Drain and switch bs back to the QEMU main loop. After drain, the
+ * device will not submit (nor complete) any requests until dataplane
+ * starts again.
+ */
blk_set_aio_context(s->conf->conf.blk, qemu_get_aio_context());
+ /* Notify guest before the guest notifiers get cleaned up */
+ qemu_bh_cancel(s->bh);
+ notify_guest_bh(s);
+
aio_context_release(s->ctx);
for (i = 0; i < nvqs; i++) {