From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 2/4] usb-storage: cancel I/O on reset
Date: Fri, 6 Jan 2012 13:50:30 +0100 [thread overview]
Message-ID: <1325854232-17478-3-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1325854232-17478-1-git-send-email-kraxel@redhat.com>
When resetting the usb-storage device we'll have to carefully cancel
and clear any requests which might be in flight, otherwise we'll confuse
the state machine.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb-msd.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index 4c06950..3147131 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -278,6 +278,18 @@ static void usb_msd_handle_reset(USBDevice *dev)
MSDState *s = (MSDState *)dev;
DPRINTF("Reset\n");
+ if (s->req) {
+ scsi_req_cancel(s->req);
+ }
+ assert(s->req == NULL);
+
+ if (s->packet) {
+ USBPacket *p = s->packet;
+ s->packet = NULL;
+ p->result = USB_RET_STALL;
+ usb_packet_complete(dev, p);
+ }
+
s->mode = USB_MSDM_CBW;
}
--
1.7.1
next prev parent reply other threads:[~2012-01-06 12:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-06 12:50 [Qemu-devel] [PULL] usb bugfix patch queue Gerd Hoffmann
2012-01-06 12:50 ` [Qemu-devel] [PATCH 1/4] Fix parse of usb device description with multiple configurations Gerd Hoffmann
2012-01-06 12:50 ` Gerd Hoffmann [this message]
2012-01-06 12:50 ` [Qemu-devel] [PATCH 3/4] usb-host: properly release port on unplug & exit Gerd Hoffmann
2012-01-06 12:50 ` [Qemu-devel] [PATCH 4/4] usb-ohci: td.cbp incorrectly updated near page end Gerd Hoffmann
2012-01-09 14:52 ` [Qemu-devel] [PULL] usb bugfix patch queue Anthony Liguori
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=1325854232-17478-3-git-send-email-kraxel@redhat.com \
--to=kraxel@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).