mirror_qemu/hw/scsi
Stefan Hajnoczi 8449bcf949 virtio-scsi: fix hotplug ->reset() vs event race
There is a race condition during hotplug when iothread is used.  It
occurs because virtio-scsi may be processing command queues in the
iothread while the monitor performs SCSI device hotplug.

When a SCSI device is hotplugged the HotplugHandler->plug() callback is
invoked and virtio-scsi emits a rescan event to the guest.

If the guest submits a SCSI command at this point then it may be
cancelled before hotplug completes.  This happens because ->reset() is
called by hw/core/qdev.c:device_set_realized() after
HotplugHandler->plug() has been called and
hw/scsi/scsi-disk.c:scsi_disk_reset() purges all requests.

This patch uses the new HotplugHandler->post_plug() callback to emit the
rescan event after ->reset().  This eliminates the race conditions where
requests could be cancelled.

Reported-by: l00284672 <lizhengui@huawei.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20180716083732.3347-3-stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-07-16 16:58:16 +02:00
..
Makefile.objs hw: make virtio devices configurable via default-configs/ 2018-06-01 15:14:31 +02:00
esp-pci.c pci: Add INTERFACE_CONVENTIONAL_PCI_DEVICE to Conventional PCI devices 2017-10-15 05:54:43 +03:00
esp.c esp: remove legacy esp_init() function 2018-06-28 19:05:36 +02:00
lsi53c895a.c hw/ppc/prep: Fix implicit creation of "-drive if=scsi" devices 2018-03-18 18:27:23 +11:00
megasas.c pci: removed the is_express field since a uniform interface was inserted 2018-02-08 21:06:41 +02:00
mfi.h Clean up header guards that don't match their file name 2016-07-12 16:19:16 +02:00
mpi.h hw: Add support for LSI SAS1068 (mptsas) device 2016-02-09 15:45:26 +01:00
mptconfig.c scsi: mptconfig: fix misuse of MPTSAS_CONFIG_PACK 2016-09-13 19:08:46 +02:00
mptendian.c hw: Do not include "sysemu/block-backend.h" if it is not necessary 2018-03-12 16:12:46 +01:00
mptsas.c hw: Do not include "sysemu/block-backend.h" if it is not necessary 2018-06-01 14:15:10 +02:00
mptsas.h mptsas: really fix migration compatibility 2016-08-03 18:44:56 +02:00
scsi-bus.c usb-storage: Add rerror/werror properties 2018-06-29 14:20:56 +02:00
scsi-disk.c scsi-disk: Block Device Characteristics emulation fix 2018-07-12 18:24:08 +02:00
scsi-generic.c hw/scsi: add VPD Block Limits emulation 2018-06-29 13:02:50 +02:00
spapr_vscsi.c scsi: Remove automatic creation of SCSI controllers with -drive if=scsi 2018-03-06 14:00:59 +01:00
srp.h spapr-vscsi: add task management 2013-09-12 08:46:21 +02:00
trace-events trace-events: fix code style: print 0x before hex numbers 2017-08-01 12:13:07 +01:00
vhost-scsi-common.c vhost-scsi: drop an unused include 2018-06-01 19:20:37 +03:00
vhost-scsi.c vhost-scsi: add missing virtqueue_size parameter 2017-12-05 12:38:31 +00:00
vhost-user-scsi.c vhost-user: introduce shared vhost-user state 2018-05-24 21:14:11 +03:00
viosrp.h hw: move private headers to hw/ subdirectories. 2013-04-08 18:13:16 +02:00
virtio-scsi-dataplane.c Replace '-enable-kvm' with '-accel kvm' in docs and help texts 2018-06-28 19:05:32 +02:00
virtio-scsi.c virtio-scsi: fix hotplug ->reset() vs event race 2018-07-16 16:58:16 +02:00
vmw_pvscsi.c qdev: use device_class_set_parent_realize/unrealize/reset() 2018-02-05 13:54:38 +01:00
vmw_pvscsi.h scsi: VMWare PVSCSI paravirtual device implementation 2013-04-19 10:44:17 +02:00