cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
9ae3a8
From c8644154fb4b460f00c9d24ed9090edc40fef067 Mon Sep 17 00:00:00 2001
9ae3a8
From: Fam Zheng <famz@redhat.com>
9ae3a8
Date: Mon, 11 Jul 2016 05:33:39 +0200
9ae3a8
Subject: [PATCH 6/7] scsi: Advertise limits by blocksize, not 512
9ae3a8
9ae3a8
RH-Author: Fam Zheng <famz@redhat.com>
9ae3a8
Message-id: <1468215219-30793-7-git-send-email-famz@redhat.com>
9ae3a8
Patchwork-id: 71110
9ae3a8
O-Subject: [RHEL-7.3 qemu-kvm PATCH 6/6] scsi: Advertise limits by blocksize, not 512
9ae3a8
Bugzilla: 1318199
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
RH-Acked-by: John Snow <jsnow@redhat.com>
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
9ae3a8
From: Eric Blake <eblake@redhat.com>
9ae3a8
9ae3a8
s->blocksize may be larger than 512, in which case our
9ae3a8
tweaks to max_xfer_len and opt_xfer_len must be scaled
9ae3a8
appropriately.
9ae3a8
9ae3a8
CC: qemu-stable@nongnu.org
9ae3a8
Reported-by: Fam Zheng <famz@redhat.com>
9ae3a8
Signed-off-by: Eric Blake <eblake@redhat.com>
9ae3a8
Reviewed-by: Fam Zheng <famz@redhat.com>
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
(cherry picked from commit efaf4781a995aacd22b1dd521b14e4644bafae14)
9ae3a8
9ae3a8
 Conflicts:
9ae3a8
	hw/scsi/scsi-generic.c
9ae3a8
Downstream uses bdrv_get_max_transfer_length().
9ae3a8
9ae3a8
Signed-off-by: Fam Zheng <famz@redhat.com>
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 hw/scsi/scsi-generic.c | 3 ++-
9ae3a8
 1 file changed, 2 insertions(+), 1 deletion(-)
9ae3a8
9ae3a8
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
9ae3a8
index 6b0c1fe..ced92f7 100644
9ae3a8
--- a/hw/scsi/scsi-generic.c
9ae3a8
+++ b/hw/scsi/scsi-generic.c
9ae3a8
@@ -210,7 +210,8 @@ static void scsi_read_complete(void * opaque, int ret)
9ae3a8
         } else if (s->type == TYPE_DISK &&
9ae3a8
             r->req.cmd.buf[0] == INQUIRY &&
9ae3a8
             r->req.cmd.buf[2] == 0xb0) {
9ae3a8
-            uint32_t max_xfer_len = bdrv_get_max_transfer_length(s->conf.bs);
9ae3a8
+            uint32_t max_xfer_len = bdrv_get_max_transfer_length(s->conf.bs) /
9ae3a8
+                (s->blocksize / BDRV_SECTOR_SIZE);
9ae3a8
             if (max_xfer_len) {
9ae3a8
                 stl_be_p(&r->buf[8], max_xfer_len);
9ae3a8
                 /* Also take care of the opt xfer len. */
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8