virtio-scsi: actually honor sense_size from configuration space
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 6 Mar 2014 10:18:53 +0000 (11:18 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 14 Mar 2014 12:38:03 +0000 (13:38 +0100)
We were always truncating the sense size to 96 bytes.

Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/scsi/virtio-scsi.c

index 6610b3aab33ddb2e7f61bdfd80982ff699f90d47..b0d7517cb1273b453498ec7fa096ef754bd8b9d1 100644 (file)
@@ -304,6 +304,8 @@ static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status,
                                          size_t resid)
 {
     VirtIOSCSIReq *req = r->hba_private;
+    VirtIOSCSI *s = req->dev;
+    VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
     uint32_t sense_len;
 
     if (r->io_canceled) {
@@ -317,7 +319,7 @@ static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status,
     } else {
         req->resp.cmd->resid = 0;
         sense_len = scsi_req_get_sense(r, req->resp.cmd->sense,
-                                       VIRTIO_SCSI_SENSE_SIZE);
+                                       vs->sense_size);
         req->resp.cmd->sense_len = tswap32(sense_len);
     }
     virtio_scsi_complete_req(req);