From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47237) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGlKD-0006VO-Cg for qemu-devel@nongnu.org; Fri, 21 Feb 2014 03:19:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WGlK2-0001sv-45 for qemu-devel@nongnu.org; Fri, 21 Feb 2014 03:19:13 -0500 Received: from e38.co.us.ibm.com ([32.97.110.159]:43510) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGlK1-0001rh-Ld for qemu-devel@nongnu.org; Fri, 21 Feb 2014 03:19:01 -0500 Received: from /spool/local by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 21 Feb 2014 01:19:01 -0700 From: Michael Roth Date: Fri, 21 Feb 2014 02:17:20 -0600 Message-Id: <1392970647-21528-45-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1392970647-21528-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1392970647-21528-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 44/51] virtio-scsi: Cleanup of I/Os that never started List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: lersek@redhat.com, qemu-stable@nongnu.org, Petar.Jovanovic@imgtec.com From: Eric Farman There is still a small window that occurs when a cancel I/O affects an asynchronous I/O operation that hasn't started. In other words, when the residual data length equals the expected data length. Today, the routine virtio_scsi_command_complete fails because the VirtIOSCSIReq pointer (from the hba_private field in SCSIRequest) was cleared earlier when virtio_scsi_complete_req was called by the virtio_scsi_request_cancelled routine. As a result, the virtio_scsi_command_complete routine needs to simply return when it is processing a SCSIRequest block that was marked canceled. Signed-off-by: Eric Farman Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini (cherry picked from commit e9c0f0f58ad0a41c3c4b19e1911cfe095afc09ca) Signed-off-by: Michael Roth --- hw/scsi/virtio-scsi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index 83344ea..5e524b2 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -306,6 +306,10 @@ static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status, VirtIOSCSIReq *req = r->hba_private; uint32_t sense_len; + if (r->io_canceled) { + return; + } + req->resp.cmd->response = VIRTIO_SCSI_S_OK; req->resp.cmd->status = status; if (req->resp.cmd->status == GOOD) { -- 1.7.9.5