From patchwork Fri Apr 1 13:19:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 8724521 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 1EA309F38C for ; Fri, 1 Apr 2016 13:21:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6C4FE203AE for ; Fri, 1 Apr 2016 13:21:05 +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 BE4A420251 for ; Fri, 1 Apr 2016 13:21:03 +0000 (UTC) Received: from localhost ([::1]:44326 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alz0Z-0000xx-2q for patchwork-qemu-devel@patchwork.kernel.org; Fri, 01 Apr 2016 09:21:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56255) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alyzb-0008He-As for qemu-devel@nongnu.org; Fri, 01 Apr 2016 09:20:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1alyza-0001rU-Ft for qemu-devel@nongnu.org; Fri, 01 Apr 2016 09:20:03 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:34809) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alyza-0001rE-9v for qemu-devel@nongnu.org; Fri, 01 Apr 2016 09:20:02 -0400 Received: by mail-wm0-x242.google.com with SMTP id p65so4579697wmp.1 for ; Fri, 01 Apr 2016 06:20:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=c5lxnfyENQohUlFhvuaSpcHMeqCU5XfbvKyT9xW+1vM=; b=kjoinEZ782OnrfdtzQTj72rLVodOhQ2LZewbmo+zZC8y4GDcHbZ0ygv/bOisdOUJSj T0b4lm2RRVwCpgXKG1pRy62pgPtxYu5URBpFhcQAi85iW48ibeQvCcoGwWdWFtXC2KAs g//OsXBMF0ulnct0q2qIEnqYuZ+pBIcVEVuuuN84D2JOaYpJifWvWqxRsmBcThtEI4Vd IguJiUll74t3xQELRQqiiH1AM9ee8ZQx92VdO84TsDzpAVfVXL0BWSOrmhUq8JAFn5DT XbJyngYkD3qlp3tFPcoPxYmty/Z34lewnNvIlzh9YC5s1P9b0UdxD4wlwTyntjngAQfp gL5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=c5lxnfyENQohUlFhvuaSpcHMeqCU5XfbvKyT9xW+1vM=; b=hTT7fUms4lv32R7XlDtx+SoaVLMQAEMsOTUnQtiWR1at9meCAAAz6Y4K7kiilwKBW/ O7b+CLkRiwRUvtsngUMg/BcXzd03aW+2XLu05pVsKx5OAnpuK+UDCSuXRHR6bBhprhOa XF4BdiJxCTrUmM5+cHgqycj8DF9bPrX3F5r/XVwmOb4q/pD1oTWZMmWvujPm97ZF479r 3GCWFI04gr+xML641+dnPG1MM/mnVSNZPndxN/uRJFih+K1rWMwKt2kWBIVJtJCMCADt 4xOF2YVM1bF6mK+El/hrcSs6o+J0vxT1Jh0CunNYI34FxPRS+tvg0ukYkWvuoHBGQWhL kaow== X-Gm-Message-State: AD7BkJLsI1swi+TMoe/57rA4dzFHCKEhU/5KbEhsCmmTDS0F3m24AOzzXXX/Rv/vUd8/Ig== X-Received: by 10.28.213.142 with SMTP id m136mr4042965wmg.24.1459516801816; Fri, 01 Apr 2016 06:20:01 -0700 (PDT) Received: from 640k.lan (94-39-141-76.adsl-ull.clienti.tiscali.it. [94.39.141.76]) by smtp.gmail.com with ESMTPSA id a1sm14032334wje.43.2016.04.01.06.20.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Apr 2016 06:20:01 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 1 Apr 2016 15:19:49 +0200 Message-Id: <1459516794-23629-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1459516794-23629-1-git-send-email-pbonzini@redhat.com> References: <1459516794-23629-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::242 Cc: famz@redhat.com, tubo@linux.vnet.ibm.com, mst@redhat.com, borntraeger@de.ibm.com, stefanha@redhat.com, cornelia.huck@de.ibm.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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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. Reviewed-by: Cornelia Huck Signed-off-by: Paolo Bonzini --- 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 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)) { 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;