From 940a4df5067ddf38797bb3dc8aa9d3ce928af494 Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <pbonzini@redhat.com>
Date: Wed, 21 Mar 2012 09:28:32 -0300
Subject: [RHEL6 qemu-kvm PATCH 1/6] virtio-scsi: fix cmd/lun cut-and-paste errors

RH-Author: Paolo Bonzini <pbonzini@redhat.com>
Message-id: <1332322116-12270-2-git-send-email-pbonzini@redhat.com>
Patchwork-id: 38773
O-Subject: [RHEL 6.3 qemu-kvm PATCH 1/5] virtio-scsi: fix cmd/lun cut-and-paste errors
Bugzilla: 788942
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>

Bugzilla: 788942

These were spotted upstream after the RHEL6 patch was committed.
(Upstream commit 06114d72f6dba13c66a5d16eeb52d5b52165117c is the
equivalent of RHEL commit 871d4f17fa967a01d3d03c805f9ee215a4e69f13).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/virtio-scsi.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/virtio-scsi.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/virtio-scsi.c b/hw/virtio-scsi.c
index b155755..32a3bdb 100644
--- a/hw/virtio-scsi.c
+++ b/hw/virtio-scsi.c
@@ -268,7 +268,7 @@ static void *virtio_scsi_load_request(QEMUFile *f, SCSIRequest *sreq)
 
 static void virtio_scsi_do_tmf(VirtIOSCSI *s, VirtIOSCSIReq *req)
 {
-    SCSIDevice *d = virtio_scsi_device_find(s, req->req.cmd->lun);
+    SCSIDevice *d = virtio_scsi_device_find(s, req->req.tmf->lun);
     SCSIRequest *r, *next;
     DeviceState *qdev;
     int target;
@@ -282,11 +282,11 @@ static void virtio_scsi_do_tmf(VirtIOSCSI *s, VirtIOSCSIReq *req)
         if (!d) {
             goto fail;
         }
-        if (d->lun != virtio_scsi_get_lun(req->req.cmd->lun)) {
+        if (d->lun != virtio_scsi_get_lun(req->req.tmf->lun)) {
             goto incorrect_lun;
         }
         QTAILQ_FOREACH_SAFE(r, &d->requests, next, next) {
-            if (r->tag == req->req.cmd->tag) {
+            if (r->tag == req->req.tmf->tag) {
                 break;
             }
         }
@@ -306,7 +306,7 @@ static void virtio_scsi_do_tmf(VirtIOSCSI *s, VirtIOSCSIReq *req)
         if (!d) {
             goto fail;
         }
-        if (d->lun != virtio_scsi_get_lun(req->req.cmd->lun)) {
+        if (d->lun != virtio_scsi_get_lun(req->req.tmf->lun)) {
             goto incorrect_lun;
         }
         s->resetting++;
@@ -320,7 +320,7 @@ static void virtio_scsi_do_tmf(VirtIOSCSI *s, VirtIOSCSIReq *req)
         if (!d) {
             goto fail;
         }
-        if (d->lun != virtio_scsi_get_lun(req->req.cmd->lun)) {
+        if (d->lun != virtio_scsi_get_lun(req->req.tmf->lun)) {
             goto incorrect_lun;
         }
         QTAILQ_FOREACH_SAFE(r, &d->requests, next, next) {
@@ -339,7 +339,7 @@ static void virtio_scsi_do_tmf(VirtIOSCSI *s, VirtIOSCSIReq *req)
         break;
 
     case VIRTIO_SCSI_T_TMF_I_T_NEXUS_RESET:
-        target = req->req.cmd->lun[1];
+        target = req->req.tmf->lun[1];
         s->resetting++;
         QTAILQ_FOREACH(qdev, &s->bus.qbus.children, sibling) {
              d = DO_UPCAST(SCSIDevice, qdev, qdev);
-- 
1.7.3.2

