yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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