From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: famz@redhat.com
Subject: [Qemu-devel] [PATCH] scsi: use scsi_req_cancel_async when purging requests
Date: Wed, 16 Dec 2015 19:33:43 +0100 [thread overview]
Message-ID: <1450290827-30508-1-git-send-email-pbonzini@redhat.com> (raw)
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
next reply other threads:[~2015-12-16 18:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-16 18:33 Paolo Bonzini [this message]
2015-12-17 1:24 ` [Qemu-devel] [PATCH] scsi: use scsi_req_cancel_async when purging requests Fam Zheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1450290827-30508-1-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=famz@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).