1 From 76fcbe46a52b467cd2cd96a671bfccd26871153e Mon Sep 17 00:00:00 2001
2 From: Ronnie Sahlberg <ronniesahlberg@gmail.com>
3 Date: Thu, 30 Aug 2012 17:28:40 -0700
4 Subject: [PATCH] iSCSI: We need to support SG_IO also from iscsi_ioctl()
6 We need to support SG_IO from the synchronous iscsi_ioctl() since
7 scsi-block uses this to do an INQ to the device to discover its properties
8 This patch makes scsi-block work with iscsi.
10 Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
11 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 (cherry picked from commit f1a12821d7df2e4d21be4f2206f84b4640533e53)
14 Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
16 block/iscsi.c | 17 +++++++++++++++++
17 1 file changed, 17 insertions(+)
19 diff --git a/block/iscsi.c b/block/iscsi.c
20 index 0b96165..ea16609 100644
23 @@ -628,9 +628,17 @@ static BlockDriverAIOCB *iscsi_aio_ioctl(BlockDriverState *bs,
28 +static void ioctl_cb(void *opaque, int status)
30 + int *p_status = opaque;
34 static int iscsi_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
36 IscsiLun *iscsilun = bs->opaque;
40 case SG_GET_VERSION_NUM:
41 @@ -639,6 +647,15 @@ static int iscsi_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
43 ((struct sg_scsi_id *)buf)->scsi_type = iscsilun->type;
46 + status = -EINPROGRESS;
47 + iscsi_aio_ioctl(bs, req, buf, ioctl_cb, &status);
49 + while (status == -EINPROGRESS) {