Patchwork [1/4] ISCSI: Only call READCAPACITY16 for SBC devices

login
register
mail settings
Submitter ronniesahlberg@gmail.com
Date May 26, 2012, 4:56 a.m.
Message ID <1338008201-29078-2-git-send-email-ronniesahlberg@gmail.com>
Download mbox | patch
Permalink /patch/161446/
State New
Headers show

Comments

ronniesahlberg@gmail.com - May 26, 2012, 4:56 a.m.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
---
 block/iscsi.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

Patch

diff --git a/block/iscsi.c b/block/iscsi.c
index df0b6c8..39d75cb 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -727,13 +727,20 @@  iscsi_inquiry_cb(struct iscsi_context *iscsi, int status, void *command_data,
 
     scsi_free_scsi_task(task);
 
-    task = iscsi_readcapacity16_task(iscsi, itask->iscsilun->lun,
+    switch (itask->iscsilun->type) {
+    case TYPE_DISK:
+        task = iscsi_readcapacity16_task(iscsi, itask->iscsilun->lun,
                                    iscsi_readcapacity16_cb, opaque);
-    if (task == NULL) {
-        error_report("iSCSI: failed to send readcapacity16 command.");
-        itask->status   = 1;
+        if (task == NULL) {
+            error_report("iSCSI: failed to send readcapacity16 command.");
+            itask->status   = 1;
+            itask->complete = 1;
+            return;
+        }
+        break;
+    default:
+        itask->status   = 0;
         itask->complete = 1;
-        return;
     }
 }