qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] scsi: use scsi_req_cancel_async when purging requests
@ 2015-12-16 18:33 Paolo Bonzini
  2015-12-17  1:24 ` Fam Zheng
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2015-12-16 18:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: famz

This avoids calls to aio_poll without having acquired the context first.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-17  1:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-16 18:33 [Qemu-devel] [PATCH] scsi: use scsi_req_cancel_async when purging requests Paolo Bonzini
2015-12-17  1:24 ` Fam Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).