From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45116) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9jMK-0007pV-UG for qemu-devel@nongnu.org; Thu, 17 Dec 2015 19:57:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9jMF-0001W0-Sm for qemu-devel@nongnu.org; Thu, 17 Dec 2015 19:57:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50661) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9jMF-0001Vv-Nq for qemu-devel@nongnu.org; Thu, 17 Dec 2015 19:57:19 -0500 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 3001F8A14F for ; Fri, 18 Dec 2015 00:57:19 +0000 (UTC) Date: Fri, 18 Dec 2015 08:57:16 +0800 From: Fam Zheng Message-ID: <20151218005716.GD25529@ad.usersys.redhat.com> References: <1450374401-31352-1-git-send-email-pbonzini@redhat.com> <1450374401-31352-44-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1450374401-31352-44-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PULL 43/45] scsi: always call notifier on async cancellation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On Thu, 12/17 18:46, Paolo Bonzini wrote: > 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; > -- > 2.5.0 > > > Oh hang on, in scsi_req_dequeue, if req->enqueued is already false, the matching scsi_req_unref is never called. Won't it be leaked? Fam