From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35915) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9U8C-00069y-VA for qemu-devel@nongnu.org; Thu, 17 Dec 2015 03:41:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9U87-0003Ir-RN for qemu-devel@nongnu.org; Thu, 17 Dec 2015 03:41:48 -0500 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]:36000) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9U87-0003Ie-KU for qemu-devel@nongnu.org; Thu, 17 Dec 2015 03:41:43 -0500 Received: by mail-wm0-x231.google.com with SMTP id p187so10385870wmp.1 for ; Thu, 17 Dec 2015 00:41:43 -0800 (PST) Sender: Paolo Bonzini References: <1450290827-30508-2-git-send-email-pbonzini@redhat.com> <20151217011527.GB20007@ad.usersys.redhat.com> From: Paolo Bonzini Message-ID: <56727545.60203@redhat.com> Date: Thu, 17 Dec 2015 09:41:41 +0100 MIME-Version: 1.0 In-Reply-To: <20151217011527.GB20007@ad.usersys.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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: Fam Zheng Cc: qemu-devel@nongnu.org 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. Paolo