mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
virtio-scsi: Forbid devices with different iothreads sharing a blockdev
This patch forbids attaching a disk to a SCSI device if its using a different AioContext. Test case included. Signed-off-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
3ff35ba391
commit
eb97813ff5
3 changed files with 49 additions and 0 deletions
|
@ -791,9 +791,16 @@ static void virtio_scsi_hotplug(HotplugHandler *hotplug_dev, DeviceState *dev,
|
|||
SCSIDevice *sd = SCSI_DEVICE(dev);
|
||||
|
||||
if (s->ctx && !s->dataplane_fenced) {
|
||||
AioContext *ctx;
|
||||
if (blk_op_is_blocked(sd->conf.blk, BLOCK_OP_TYPE_DATAPLANE, errp)) {
|
||||
return;
|
||||
}
|
||||
ctx = blk_get_aio_context(sd->conf.blk);
|
||||
if (ctx != s->ctx && ctx != qemu_get_aio_context()) {
|
||||
error_setg(errp, "Cannot attach a blockdev that is using "
|
||||
"a different iothread");
|
||||
return;
|
||||
}
|
||||
virtio_scsi_acquire(s);
|
||||
blk_set_aio_context(sd->conf.blk, s->ctx);
|
||||
virtio_scsi_release(s);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue