From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60241) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aoRNL-0000zk-K0 for qemu-devel@nongnu.org; Fri, 08 Apr 2016 04:02:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aoRNK-0005mx-Mn for qemu-devel@nongnu.org; Fri, 08 Apr 2016 04:02:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38953) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aoRNK-0005mr-HR for qemu-devel@nongnu.org; Fri, 08 Apr 2016 04:02:42 -0400 Date: Fri, 8 Apr 2016 11:02:38 +0300 From: "Michael S. Tsirkin" Message-ID: <1460102154-16096-11-git-send-email-mst@redhat.com> References: <1460102154-16096-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1460102154-16096-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 10/15] virtio-scsi: fix disabled mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Paolo Bonzini , Cornelia Huck From: Paolo Bonzini Add two missing checks for s->dataplane_fenced. In one case, QEMU would skip injecting an IRQ due to a write to an uninitialized EventNotifier's file descriptor. In the second case, the dataplane_disabled field was used by mistake; in fact after fixing this occurrence it is completely unused. Reviewed-by: Cornelia Huck Signed-off-by: Paolo Bonzini Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/virtio-scsi.h | 1 - hw/scsi/virtio-scsi.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h index 209eaa4..eef4e95 100644 --- a/include/hw/virtio/virtio-scsi.h +++ b/include/hw/virtio/virtio-scsi.h @@ -91,7 +91,6 @@ typedef struct VirtIOSCSI { bool dataplane_started; bool dataplane_starting; bool dataplane_stopping; - bool dataplane_disabled; bool dataplane_fenced; Error *blocker; uint32_t host_features; diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index ade4972..38f1e2c 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -68,7 +68,7 @@ static void virtio_scsi_complete_req(VirtIOSCSIReq *req) qemu_iovec_from_buf(&req->resp_iov, 0, &req->resp, req->resp_size); virtqueue_push(vq, &req->elem, req->qsgl.size + req->resp_iov.size); - if (s->dataplane_started) { + if (s->dataplane_started && !s->dataplane_fenced) { virtio_scsi_dataplane_notify(vdev, req); } else { virtio_notify(vdev, vq); @@ -773,7 +773,7 @@ static void virtio_scsi_hotplug(HotplugHandler *hotplug_dev, DeviceState *dev, VirtIOSCSI *s = VIRTIO_SCSI(vdev); SCSIDevice *sd = SCSI_DEVICE(dev); - if (s->ctx && !s->dataplane_disabled) { + if (s->ctx && !s->dataplane_fenced) { VirtIOSCSIBlkChangeNotifier *insert_notifier, *remove_notifier; if (blk_op_is_blocked(sd->conf.blk, BLOCK_OP_TYPE_DATAPLANE, errp)) { -- MST