qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] scsi: use scsi_req_cancel_async when purging reques


From: Paolo Bonzini
Subject: [Qemu-devel] [PATCH] scsi: use scsi_req_cancel_async when purging requests
Date: Wed, 16 Dec 2015 19:33:43 +0100

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

Signed-off-by: Paolo Bonzini <address@hidden>
---
 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]