Message ID | 1449716386-5652-1-git-send-email-lszhu@suse.com |
---|---|
State | New |
Headers | show |
Yeah, I assume that is an easy and efficient solution Thanks On 12/10/2015 04:57 PM, Peter Lieven wrote: > Am 10.12.2015 um 09:55 schrieb Paolo Bonzini: >> >> On 10/12/2015 03:59, Zhu Lingshan wrote: >>> - 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 > > >
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) {
This Patch would fix a bug that readcapacity10 failuare would be shown no matter readcapacy10 or readcapacity16 actually sent. Signed-off-by: Zhu Lingshan <lszhu@suse.com> --- block/iscsi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)