From patchwork Thu Dec 17 17:46:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 558532 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 995581402CD for ; Fri, 18 Dec 2015 05:09:59 +1100 (AEDT) Received: from localhost ([::1]:55733 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9d01-0000At-By for incoming@patchwork.ozlabs.org; Thu, 17 Dec 2015 13:09:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51507) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9cej-0002Ey-BH for qemu-devel@nongnu.org; Thu, 17 Dec 2015 12:48:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9cei-00071r-Fk for qemu-devel@nongnu.org; Thu, 17 Dec 2015 12:47:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54804) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9cei-00071i-Az for qemu-devel@nongnu.org; Thu, 17 Dec 2015 12:47:56 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id EBE32693DB for ; Thu, 17 Dec 2015 17:47:55 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-23.ams2.redhat.com [10.36.112.23]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tBHHkfcj014618 for ; Thu, 17 Dec 2015 12:47:55 -0500 From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 17 Dec 2015 18:46:39 +0100 Message-Id: <1450374401-31352-44-git-send-email-pbonzini@redhat.com> In-Reply-To: <1450374401-31352-1-git-send-email-pbonzini@redhat.com> References: <1450374401-31352-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 43/45] scsi: always call notifier on async cancellation 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This was found by code inspection. If the request is cancelled twice, the notifier is never called on the second cancellation request, and hence for example a TMF might never finish. All the calls in scsi_req_cancel_async are idempotent, so the change is safe. Reviewed-by: Fam Zheng Signed-off-by: Paolo Bonzini Message-Id: <1450290827-30508-2-git-send-email-pbonzini@redhat.com> --- hw/scsi/scsi-bus.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index a600074..00bddc9 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -1759,9 +1759,6 @@ void scsi_req_cancel_async(SCSIRequest *req, Notifier *notifier) if (notifier) { notifier_list_add(&req->cancel_notifiers, notifier); } - if (req->io_canceled) { - return; - } scsi_req_ref(req); scsi_req_dequeue(req); req->io_canceled = true;