From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9NIm-0006Fr-Qy for qemu-devel@nongnu.org; Wed, 16 Dec 2015 20:24:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9NIi-0000nR-Qo for qemu-devel@nongnu.org; Wed, 16 Dec 2015 20:24:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36493) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9NIi-0000nB-Lm for qemu-devel@nongnu.org; Wed, 16 Dec 2015 20:24:12 -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 1D2C2C0B7E27 for ; Thu, 17 Dec 2015 01:24:11 +0000 (UTC) Date: Thu, 17 Dec 2015 09:24:09 +0800 From: Fam Zheng Message-ID: <20151217012409.GC20007@ad.usersys.redhat.com> References: <1450290827-30508-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1450290827-30508-1-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH] scsi: use scsi_req_cancel_async when purging requests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On Wed, 12/16 19:33, Paolo Bonzini wrote: > This avoids calls to aio_poll without having acquired the context first. > > Signed-off-by: Paolo Bonzini > --- > hw/scsi/scsi-bus.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c > index fd1171e..524a998 100644 > --- a/hw/scsi/scsi-bus.c > +++ b/hw/scsi/scsi-bus.c > @@ -1843,9 +1843,11 @@ void scsi_device_purge_requests(SCSIDevice *sdev, SCSISense sense) > > while (!QTAILQ_EMPTY(&sdev->requests)) { > req = QTAILQ_FIRST(&sdev->requests); > - scsi_req_cancel(req); > + scsi_req_cancel_async(req, NULL); > } > - > + aio_context_acquire(bdrv_get_aio_context(sdev->conf.blk)); > + blk_drain(sdev->conf.blk); > + aio_context_release(bdrv_get_aio_context(sdev->conf.blk)); > scsi_device_set_ua(sdev, sense); > } > > -- > 2.5.0 > > Reviewed-by: Fam Zheng