mbox series

[v2,0/2] virtio-scsi: fix hotplug ->reset() vs event race

Message ID 20180716083732.3347-1-stefanha@redhat.com
Headers show
Series virtio-scsi: fix hotplug ->reset() vs event race | expand

Message

Stefan Hajnoczi July 16, 2018, 8:37 a.m. UTC
v2:
 * Drop Error **errp argument to post_plug() handler [Paolo]
 * Move post_plug() call outside if (dev->hotplugged)

The virtio-scsi command virtqueues run during hotplug.  This creates the
possibility of race conditions since the guest can submit commands while the
monitor is performing hotplug.

See Patch 2 for a fix for the ->reset() vs event race condition that Zhengui Li
encountered.

Stefan Hajnoczi (2):
  qdev: add HotplugHandler->post_plug() callback
  virtio-scsi: fix hotplug ->reset() vs event race

 include/hw/hotplug.h  | 11 +++++++++++
 hw/core/hotplug.c     | 10 ++++++++++
 hw/core/qdev.c        |  4 ++++
 hw/scsi/virtio-scsi.c | 11 ++++++++++-
 4 files changed, 35 insertions(+), 1 deletion(-)

Comments

Igor Mammedov July 16, 2018, 9:28 a.m. UTC | #1
On Mon, 16 Jul 2018 09:37:30 +0100
Stefan Hajnoczi <stefanha@redhat.com> wrote:

> v2:
>  * Drop Error **errp argument to post_plug() handler [Paolo]
>  * Move post_plug() call outside if (dev->hotplugged)
> 
> The virtio-scsi command virtqueues run during hotplug.  This creates the
> possibility of race conditions since the guest can submit commands while the
> monitor is performing hotplug.
> 
> See Patch 2 for a fix for the ->reset() vs event race condition that Zhengui Li
> encountered.
> 
> Stefan Hajnoczi (2):
>   qdev: add HotplugHandler->post_plug() callback
>   virtio-scsi: fix hotplug ->reset() vs event race
> 
>  include/hw/hotplug.h  | 11 +++++++++++
>  hw/core/hotplug.c     | 10 ++++++++++
>  hw/core/qdev.c        |  4 ++++
>  hw/scsi/virtio-scsi.c | 11 ++++++++++-
>  4 files changed, 35 insertions(+), 1 deletion(-)
> 

Reviewed-by: Igor Mammedov <imammedo@redhat.com>