summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorZhu Lingshan <lszhu@suse.com>2015-12-29 11:32:14 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2016-01-15 18:58:01 +0100
commit1cb6d137ffd380c458be2da24a58404708c0db55 (patch)
tree90bf29bc4e72a41a93ea32fac95e0742bdb73981
parent46f296cd3a3ebc3d30e2dbc1da7c4882e3d35ce5 (diff)
downloadfocaccia-qemu-1cb6d137ffd380c458be2da24a58404708c0db55.tar.gz
focaccia-qemu-1cb6d137ffd380c458be2da24a58404708c0db55.zip
iscsi: send readcapacity10 when readcapacity16 failed
When play with Dell MD3000 target, for sure it
is a TYPE_DISK, but readcapacity16 would fail.
Then we find that readcapacity10 succeeded. It
looks like the target just support readcapacity10
even through it is a TYPE_DISK or have some
TYPE_ROM characteristics.

This patch can give a chance to send
readcapacity16 when readcapacity10 failed.
This patch is not harmful to original pathes

Signed-off-by: Zhu Lingshan <lszhu@suse.com>
Message-Id: <1451359934-9236-1-git-send-email-lszhu@suse.com>
[Don't fall through on UNIT ATTENTION. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--block/iscsi.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/block/iscsi.c b/block/iscsi.c
index eb28ddcac3..3acb052b1f 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1243,8 +1243,13 @@ static void iscsi_readcapacity_sync(IscsiLun *iscsilun, Error **errp)
                     iscsilun->lbprz = !!rc16->lbprz;
                     iscsilun->use_16_for_rw = (rc16->returned_lba > 0xffffffff);
                 }
+                break;
             }
-            break;
+            if (task != NULL && task->status == SCSI_STATUS_CHECK_CONDITION
+                && task->sense.key == SCSI_SENSE_UNIT_ATTENTION) {
+                break;
+            }
+            /* Fall through and try READ CAPACITY(10) instead.  */
         case TYPE_ROM:
             task = iscsi_readcapacity10_sync(iscsilun->iscsi, iscsilun->lun, 0, 0);
             if (task != NULL && task->status == SCSI_STATUS_GOOD) {