aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi/virtio-scsi.c
diff options
context:
space:
mode:
authorAlberto Garcia <berto@igalia.com>2019-01-22 17:53:21 +0200
committerKevin Wolf <kwolf@redhat.com>2019-02-01 13:46:45 +0100
commita6f230c8d13a7ff3a0c7f1097412f44bfd9eff0b (patch)
tree29635dac7b8d16c49a65ef982bef8a5a4c9506c2 /hw/scsi/virtio-scsi.c
parent14632122b82150d42cefac04a219bbead59bc4a7 (diff)
virtio-scsi: Move BlockBackend back to the main AioContext on unplug
This fixes a crash when attaching a disk to a SCSI device using iothreads, then detaching it and reattaching it again. Test case included. Signed-off-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/scsi/virtio-scsi.c')
-rw-r--r--hw/scsi/virtio-scsi.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 3aa99717e2..e1f7b208c7 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -824,6 +824,12 @@ static void virtio_scsi_hotunplug(HotplugHandler *hotplug_dev, DeviceState *dev,
virtio_scsi_release(s);
}
+ if (s->ctx) {
+ virtio_scsi_acquire(s);
+ blk_set_aio_context(sd->conf.blk, qemu_get_aio_context());
+ virtio_scsi_release(s);
+ }
+
qdev_simple_device_unplug_cb(hotplug_dev, dev, errp);
}