qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, pbonzini@redhat.com, pl@kamp.de
Subject: [Qemu-devel] [PATCH 1/2] iscsi: Use bs->sg for everything else than disks
Date: Wed,  5 Mar 2014 16:00:48 +0100	[thread overview]
Message-ID: <1394031649-31915-2-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1394031649-31915-1-git-send-email-kwolf@redhat.com>

The current iscsi block driver code makes the rather arbitrary decision
that TYPE_MEDIUM_CHANGER and TYPE_TAPE devices have bs->sg = 1 and all
other device types are disks.

Instead of this, check for TYPE_DISK to expose the disk interface and
make everything else bs->sg = 1. In particular, this includes devices
with TYPE_STORAGE_ARRAY, which is what LUN 0 of an iscsi target is.
(See https://bugzilla.redhat.com/show_bug.cgi?id=1067784 for the exact
scenario.)

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/iscsi.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/block/iscsi.c b/block/iscsi.c
index 0a15f53..b490e98 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1231,12 +1231,11 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
     bs->total_sectors = sector_lun2qemu(iscsilun->num_blocks, iscsilun);
     bs->request_alignment = iscsilun->block_size;
 
-    /* Medium changer or tape. We dont have any emulation for this so this must
-     * be sg ioctl compatible. We force it to be sg, otherwise qemu will try
-     * to read from the device to guess the image format.
+    /* We don't have any emulation for devices other than disks and CD-ROMs, so
+     * this must be sg ioctl compatible. We force it to be sg, otherwise qemu
+     * will try to read from the device to guess the image format.
      */
-    if (iscsilun->type == TYPE_MEDIUM_CHANGER ||
-        iscsilun->type == TYPE_TAPE) {
+    if (iscsilun->type != TYPE_DISK && iscsilun->type != TYPE_ROM) {
         bs->sg = 1;
     }
 
-- 
1.8.1.4

  reply	other threads:[~2014-03-05 15:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-05 15:00 [Qemu-devel] [PATCH 0/2] iscsi: Fix bs->request_alignment failure on LUN 0 Kevin Wolf
2014-03-05 15:00 ` Kevin Wolf [this message]
2014-03-05 15:33   ` [Qemu-devel] [PATCH 1/2] iscsi: Use bs->sg for everything else than disks Benoît Canet
2014-03-05 15:41     ` Kevin Wolf
2014-03-05 15:47       ` Benoît Canet
2014-03-05 16:02   ` Peter Lieven
2014-03-05 16:21     ` Kevin Wolf
2014-03-05 15:00 ` [Qemu-devel] [PATCH 2/2] block: Fix bs->request_alignment assertion for bs->sg=1 Kevin Wolf
2014-03-05 15:34   ` Benoît Canet
2014-03-05 15:31 ` [Qemu-devel] [PATCH 0/2] iscsi: Fix bs->request_alignment failure on LUN 0 Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1394031649-31915-2-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pl@kamp.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).