From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41054) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9Xa1-0007e4-2g for qemu-devel@nongnu.org; Thu, 17 Dec 2015 07:22:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9XZv-000426-Og for qemu-devel@nongnu.org; Thu, 17 Dec 2015 07:22:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48074) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9XZv-00041w-Jm for qemu-devel@nongnu.org; Thu, 17 Dec 2015 07:22:39 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 721E849DD4 for ; Thu, 17 Dec 2015 12:22:38 +0000 (UTC) Date: Thu, 17 Dec 2015 20:22:33 +0800 From: Fam Zheng Message-ID: <20151217122233.GA26335@ad.usersys.redhat.com> References: <1450290827-30508-2-git-send-email-pbonzini@redhat.com> <20151217011527.GB20007@ad.usersys.redhat.com> <56727545.60203@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56727545.60203@redhat.com> Subject: Re: [Qemu-devel] [PATCH] 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 09:41, Paolo Bonzini wrote: > > > On 17/12/2015 02:15, Fam Zheng wrote: > >> > 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; > > if (req->aiocb) { > > blk_aio_cancel_async(req->aiocb); > > } else { > > scsi_req_cancel_complete(req); > > } > > > > A second TMF must be blk_aio_cancel_async case, otherwise the first one would > > have already completed the request synchronously in scsi_req_cancel_complete. > > Good point. > > > With that in mind, I think returning early is not a problem. But I suppose > > these are also idempotent so this change is not breaking anything, either. > > Right, the issue is that all these calls are idempotent, but the > notifier may not; that is why I prefer to be safe and ensure that all > notifier additions are matched by a notify. But you explained well why > this should be safe, I'll add a note to the commit message. > Thanks, please add my Reviewed-by: Fam Zheng