Skip to contentSkip to conversation

fix:readcapacity 10 failure shown even 16 sent

PATCH In review Zhu Lingshan 3 participants 4 messages Dec 10, 2015 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix:readcapacity 10 failure shown even 16 sent

This Patch would fix a bug that readcapacity10
failuare would be shown no matter readcapacy10
or readcapacity16 actually sent.

---
 block/iscsi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
block/iscsi.c +4 -1
index bd1f1bf..6425cf4 100644
@@ -1269,7 +1269,10 @@ static void iscsi_readcapacity_sync(IscsiLun *iscsilun, Error **errp)
              && task->sense.key == SCSI_SENSE_UNIT_ATTENTION
              && retries-- > 0);
 
-    if (task == NULL || task->status != SCSI_STATUS_GOOD) {
+    if ((rc16 != NULL) && ((task == NULL) || (task->status != SCSI_STATUS_GOOD))) {
+        error_setg(errp, "iSCSI: failed to send readcapacity16 command.");
+    }
+    if ((rc10 != NULL) && ((task == NULL) || (task->status != SCSI_STATUS_GOOD))) {
         error_setg(errp, "iSCSI: failed to send readcapacity10 command.");
     } else if (!iscsilun->block_size ||
                iscsilun->block_size % BDRV_SECTOR_SIZE) {
Signature · 1 line
2.6.2
#1 lore raw

block/iscsi.c static void iscsi_readcapacity_sync(IscsiLun *iscsilun, Error **errp) · line 1274

Quoted 4 lines · Zhu Lingshan
block/iscsi.c +3 -1
-    if (task == NULL || task->status != SCSI_STATUS_GOOD) {
+    if ((rc16 != NULL) && ((task == NULL) || (task->status != SCSI_STATUS_GOOD))) {
+        error_setg(errp, "iSCSI: failed to send readcapacity16 command.");
+    }

You need an "else" here.

Paolo

Quoted 3 lines
+    if ((rc10 != NULL) && ((task == NULL) || (task->status != SCSI_STATUS_GOOD))) {
         error_setg(errp, "iSCSI: failed to send readcapacity10 command.");
     } else if (!iscsilun->block_size ||
#2 lore raw

Am 10.12.2015 um 09:55 schrieb Paolo Bonzini:

Quoted 7 lines · Zhu Lingshan

block/iscsi.c static void iscsi_readcapacity_sync(IscsiLun *iscsilun, Error **errp) · line 1274

Quoted 4 lines
block/iscsi.c +3 -1
-    if (task == NULL || task->status != SCSI_STATUS_GOOD) {
+    if ((rc16 != NULL) && ((task == NULL) || (task->status != SCSI_STATUS_GOOD))) {
+        error_setg(errp, "iSCSI: failed to send readcapacity16 command.");
+    }

You need an "else" here.

rc16 can't be not NULL if task is NULL.

I would not spent to much energie here and just adjust the error message to

"iSCSI: failed to send readcapacity10/16 command."

Peter

#3 lore raw

Yeah, I assume that is an easy and efficient solution

Thanks

Quoted 21 lines · Peter Lieven

Am 10.12.2015 um 09:55 schrieb Paolo Bonzini:

Quoted 9 lines · Zhu Lingshan
Quoted 6 lines
(quoted diff) +1 -1
-    if (task == NULL || task->status != SCSI_STATUS_GOOD) {
+    if ((rc16 != NULL) && ((task == NULL) || (task->status != 

SCSI_STATUS_GOOD))) {
+ error_setg(errp, "iSCSI: failed to send readcapacity16
command.");
+ }

You need an "else" here.

rc16 can't be not NULL if task is NULL.

I would not spent to much energie here and just adjust the error message to

"iSCSI: failed to send readcapacity10/16 command."

Peter