aboutsummaryrefslogtreecommitdiff
path: root/hw
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
parent14632122b82150d42cefac04a219bbead59bc4a7 (diff)
downloadqemu-a6f230c8d13a7ff3a0c7f1097412f44bfd9eff0b.zip
qemu-a6f230c8d13a7ff3a0c7f1097412f44bfd9eff0b.tar.gz
qemu-a6f230c8d13a7ff3a0c7f1097412f44bfd9eff0b.tar.bz2
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')
-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 3aa9971..e1f7b20 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);
}