From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52332) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLuu0-0003Pz-3c for qemu-devel@nongnu.org; Fri, 07 Mar 2014 08:33:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLutu-0001iT-RL for qemu-devel@nongnu.org; Fri, 07 Mar 2014 08:33:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:4635) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLutu-0001iA-J5 for qemu-devel@nongnu.org; Fri, 07 Mar 2014 08:33:22 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s27DXL5B016284 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 7 Mar 2014 08:33:21 -0500 From: Kevin Wolf Date: Fri, 7 Mar 2014 14:32:53 +0100 Message-Id: <1394199187-9576-6-git-send-email-kwolf@redhat.com> In-Reply-To: <1394199187-9576-1-git-send-email-kwolf@redhat.com> References: <1394199187-9576-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 05/19] iscsi: Use bs->sg for everything else than disks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: 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 Reviewed-by: Benoit Canet Acked-by: Paolo Bonzini --- 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