This Patch would fix a bug that readcapacity10 failuare would be shown no matter readcapacy10 or readcapacity16 actually sent.
Signed-off-by: Zhu Lingshan <ls...@suse.com> --- block/iscsi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/block/iscsi.c b/block/iscsi.c index bd1f1bf..6425cf4 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -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) { -- 2.6.2