From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9Gth-0006Vj-Fr for qemu-devel@nongnu.org; Wed, 16 Dec 2015 13:34:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9Gtb-0005wz-Vr for qemu-devel@nongnu.org; Wed, 16 Dec 2015 13:33:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35668) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9Gtb-0005wt-QJ for qemu-devel@nongnu.org; Wed, 16 Dec 2015 13:33:51 -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 714128F260 for ; Wed, 16 Dec 2015 18:33:50 +0000 (UTC) From: Paolo Bonzini Date: Wed, 16 Dec 2015 19:33:43 +0100 Message-Id: <1450290827-30508-1-git-send-email-pbonzini@redhat.com> Subject: [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: qemu-devel@nongnu.org Cc: famz@redhat.com 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