Blame SOURCES/kvm-iscsi-Use-bs-sg-for-everything-else-than-disks.patch

0a122b
From 9273caf09add518239e77f02081bc4f455e24425 Mon Sep 17 00:00:00 2001
0a122b
From: Kevin Wolf <kwolf@redhat.com>
0a122b
Date: Mon, 10 Mar 2014 11:07:21 +0100
0a122b
Subject: [PATCH 13/16] iscsi: Use bs->sg for everything else than disks
0a122b
0a122b
RH-Author: Kevin Wolf <kwolf@redhat.com>
0a122b
Message-id: <1394449642-13562-2-git-send-email-kwolf@redhat.com>
0a122b
Patchwork-id: 58063
0a122b
O-Subject: [RHEL-7.0 qemu-kvm PATCH 1/2] iscsi: Use bs->sg for everything else than disks
0a122b
Bugzilla: 1067784
0a122b
RH-Acked-by: Juan Quintela <quintela@redhat.com>
0a122b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
0a122b
The current iscsi block driver code makes the rather arbitrary decision
0a122b
that TYPE_MEDIUM_CHANGER and TYPE_TAPE devices have bs->sg = 1 and all
0a122b
other device types are disks.
0a122b
0a122b
Instead of this, check for TYPE_DISK to expose the disk interface and
0a122b
make everything else bs->sg = 1. In particular, this includes devices
0a122b
with TYPE_STORAGE_ARRAY, which is what LUN 0 of an iscsi target is.
0a122b
(See https://bugzilla.redhat.com/show_bug.cgi?id=1067784 for the exact
0a122b
scenario.)
0a122b
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
Reviewed-by: Benoit Canet <benoit@irqsave.net>
0a122b
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
(cherry picked from commit f47c3f5a800a927238d20de9f99b5c77f0bc3fe0)
0a122b
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
---
0a122b
 block/iscsi.c | 9 ++++-----
0a122b
 1 file changed, 4 insertions(+), 5 deletions(-)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 block/iscsi.c |    9 ++++-----
0a122b
 1 files changed, 4 insertions(+), 5 deletions(-)
0a122b
0a122b
diff --git a/block/iscsi.c b/block/iscsi.c
0a122b
index 63a21e2..64a8295 100644
0a122b
--- a/block/iscsi.c
0a122b
+++ b/block/iscsi.c
0a122b
@@ -1399,12 +1399,11 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
0a122b
     bs->total_sectors = sector_lun2qemu(iscsilun->num_blocks, iscsilun);
0a122b
     bs->request_alignment = iscsilun->block_size;
0a122b
 
0a122b
-    /* Medium changer or tape. We dont have any emulation for this so this must
0a122b
-     * be sg ioctl compatible. We force it to be sg, otherwise qemu will try
0a122b
-     * to read from the device to guess the image format.
0a122b
+    /* We don't have any emulation for devices other than disks and CD-ROMs, so
0a122b
+     * this must be sg ioctl compatible. We force it to be sg, otherwise qemu
0a122b
+     * will try to read from the device to guess the image format.
0a122b
      */
0a122b
-    if (iscsilun->type == TYPE_MEDIUM_CHANGER ||
0a122b
-        iscsilun->type == TYPE_TAPE) {
0a122b
+    if (iscsilun->type != TYPE_DISK && iscsilun->type != TYPE_ROM) {
0a122b
         bs->sg = 1;
0a122b
     }
0a122b
 
0a122b
-- 
0a122b
1.7.1
0a122b