<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">From ede32960cae55049899c565e808b0198fe6c559f Mon Sep 17 00:00:00 2001
Message-Id: &lt;ede32960cae55049899c565e808b0198fe6c559f.1345545736.git.minovotn@redhat.com&gt;
In-Reply-To: &lt;004171b9879af86d3c14654d0080b5559ee48267.1345545736.git.minovotn@redhat.com&gt;
References: &lt;004171b9879af86d3c14654d0080b5559ee48267.1345545736.git.minovotn@redhat.com&gt;
From: Gerd Hoffmann &lt;kraxel@redhat.com&gt;
Date: Wed, 8 Aug 2012 12:41:10 +0200
Subject: [PATCH 2/8] usb-storage: fix SYNCHRONIZE_CACHE

RH-Author: Gerd Hoffmann &lt;kraxel@redhat.com&gt;
Message-id: &lt;1344429670-18795-1-git-send-email-kraxel@redhat.com&gt;
Patchwork-id: 40626
O-Subject: [RHEL-6.4 qemu-kvm PATCH] usb-storage: fix SYNCHRONIZE_CACHE
Bugzilla: 839957
RH-Acked-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
RH-Acked-by: Laszlo Ersek &lt;lersek@redhat.com&gt;
RH-Acked-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;

Commit 59310659073d85745854f2f10c4292555c5a1c51 is incomplete,
we'll arrive in the scsi command complete callback in CSW state
and must handle that case correctly.

Signed-off-by: Gerd Hoffmann &lt;kraxel@redhat.com&gt;
(cherry picked from commit 54414218d78c9d043417b27bb29bd0334b4e3cb5)

bugzilla: #839957 - usb-storage: SYNCHRONIZE_CACHE is broken
brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=4736741
---
 hw/usb-msd.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Signed-off-by: Michal Novotny &lt;minovotn@redhat.com&gt;
---
 hw/usb-msd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index 2f7e5cb..b5ce183 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -249,6 +249,9 @@ static void usb_msd_command_complete(SCSIRequest *req, uint32_t status, int32_t
                the status read packet.  */
             usb_msd_send_status(s, p);
             s-&gt;mode = USB_MSDM_CBW;
+        } else if (s-&gt;mode == USB_MSDM_CSW) {
+            usb_msd_send_status(s, p);
+            s-&gt;mode = USB_MSDM_CBW;
         } else {
             if (s-&gt;data_len) {
                 s-&gt;data_len -= s-&gt;usb_len;
-- 
1.7.11.2

</pre></body></html>