From patchwork Wed Mar 30 12:48:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 8696001 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 720299F3D1 for ; Wed, 30 Mar 2016 12:51:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D273B2035B for ; Wed, 30 Mar 2016 12:51:38 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1ACEB20279 for ; Wed, 30 Mar 2016 12:51:37 +0000 (UTC) Received: from localhost ([::1]:53978 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alFay-0005D3-Ir for patchwork-qemu-devel@patchwork.kernel.org; Wed, 30 Mar 2016 08:51:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42952) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alFXv-0008VN-IF for qemu-devel@nongnu.org; Wed, 30 Mar 2016 08:48:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1alFXs-0008Fo-8e for qemu-devel@nongnu.org; Wed, 30 Mar 2016 08:48:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50489) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alFXs-0008Fj-3T for qemu-devel@nongnu.org; Wed, 30 Mar 2016 08:48:24 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id AC0A47F0B4; Wed, 30 Mar 2016 12:48:23 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-37.ams2.redhat.com [10.36.112.37]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2UCmCkZ018433; Wed, 30 Mar 2016 08:48:21 -0400 From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 30 Mar 2016 14:48:03 +0200 Message-Id: <1459342088-24311-5-git-send-email-pbonzini@redhat.com> In-Reply-To: <1459342088-24311-1-git-send-email-pbonzini@redhat.com> References: <1459342088-24311-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: cornelia.huck@de.ibm.com, borntraeger@de.ibm.com, famz@redhat.com, mst@redhat.com Subject: [Qemu-devel] [PATCH 4/9] virtio-scsi: fix disabled mode X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Paolo Bonzini Reviewed-by: Cornelia Huck --- hw/scsi/virtio-scsi.c | 4 ++-- include/hw/virtio/virtio-scsi.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index 0c30d2e..ac531e2 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -67,7 +67,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); @@ -772,7 +772,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)) { 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;