From patchwork Tue Aug 7 08:59:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 175541 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A90702C009D for ; Tue, 7 Aug 2012 18:59:59 +1000 (EST) Received: from localhost ([::1]:35096 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Syfdt-0002gi-I5 for incoming@patchwork.ozlabs.org; Tue, 07 Aug 2012 04:59:57 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52401) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Syfdg-0002gb-K5 for qemu-devel@nongnu.org; Tue, 07 Aug 2012 04:59:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Syfdf-0004Ir-MP for qemu-devel@nongnu.org; Tue, 07 Aug 2012 04:59:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12278) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Syfdf-0004Ib-E5 for qemu-devel@nongnu.org; Tue, 07 Aug 2012 04:59:43 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q778xgG5032621 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 7 Aug 2012 04:59:42 -0400 Received: from rincewind.home.kraxel.org (ovpn-116-37.ams2.redhat.com [10.36.116.37]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q778xfUo011137; Tue, 7 Aug 2012 04:59:41 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id A490740D25; Tue, 7 Aug 2012 10:59:40 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 7 Aug 2012 10:59:40 +0200 Message-Id: <1344329980-25015-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1344329980-25015-1-git-send-email-kraxel@redhat.com> References: <1344329980-25015-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 2/2] usb-storage: fix SYNCHRONIZE_CACHE X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- hw/usb/dev-storage.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c index 976fe1a..ff48d91 100644 --- a/hw/usb/dev-storage.c +++ b/hw/usb/dev-storage.c @@ -247,6 +247,9 @@ static void usb_msd_command_complete(SCSIRequest *req, uint32_t status, size_t r the status read packet. */ usb_msd_send_status(s, p); s->mode = USB_MSDM_CBW; + } else if (s->mode == USB_MSDM_CSW) { + usb_msd_send_status(s, p); + s->mode = USB_MSDM_CBW; } else { if (s->data_len) { int len = (p->iov.size - p->result);