diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2015-12-16 19:33:43 +0100 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineering.com> | 2019-11-29 19:28:20 -0600 |
commit | 59af443d55f71437fb1e270099a15fe3bddfc735 (patch) | |
tree | 65fe59a16fd4781647c64bf07bfe0e361b7bb550 /hw/scsi | |
parent | 863a095bb38cbe10a845ff4e8b8674cdead3184b (diff) | |
download | hqemu-59af443d55f71437fb1e270099a15fe3bddfc735.zip hqemu-59af443d55f71437fb1e270099a15fe3bddfc735.tar.gz |
scsi: use scsi_req_cancel_async when purging requests
This avoids calls to aio_poll without having acquired the context first.
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1450290827-30508-1-git-send-email-pbonzini@redhat.com>
Diffstat (limited to 'hw/scsi')
-rw-r--r-- | hw/scsi/scsi-bus.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index fd1171e..a600074 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -1841,11 +1841,13 @@ void scsi_device_purge_requests(SCSIDevice *sdev, SCSISense sense) { SCSIRequest *req; + aio_context_acquire(blk_get_aio_context(sdev->conf.blk)); while (!QTAILQ_EMPTY(&sdev->requests)) { req = QTAILQ_FIRST(&sdev->requests); - scsi_req_cancel(req); + scsi_req_cancel_async(req, NULL); } - + blk_drain(sdev->conf.blk); + aio_context_release(blk_get_aio_context(sdev->conf.blk)); scsi_device_set_ua(sdev, sense); } |