qemu-e2k/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
..
esp-pci.c
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
Makefile.objs hw: make virtio devices configurable via default-configs/ 2018-06-01 15:14:31 +02:00
megasas.c
mfi.h
mpi.h
mptconfig.c
mptendian.c
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
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
srp.h
trace-events
vhost-scsi-common.c vhost-scsi: drop an unused include 2018-06-01 19:20:37 +03:00
vhost-scsi.c
vhost-user-scsi.c vhost-user: introduce shared vhost-user state 2018-05-24 21:14:11 +03:00
viosrp.h
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
vmw_pvscsi.h