qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] fix:readcapacity 10 failure shown even 16 sent
@ 2015-12-10  2:59 Zhu Lingshan
  2015-12-10  8:55 ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Zhu Lingshan @ 2015-12-10  2:59 UTC (permalink / raw)
  To: qemu-block, qemu-devel; +Cc: pbonzini, pl, Zhu Lingshan, ronniesahlberg

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(-)

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] fix:readcapacity 10 failure shown even 16 sent
  2015-12-10  2:59 [Qemu-devel] [PATCH] fix:readcapacity 10 failure shown even 16 sent Zhu Lingshan
@ 2015-12-10  8:55 ` Paolo Bonzini
  2015-12-10  8:57   ` Peter Lieven
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2015-12-10  8:55 UTC (permalink / raw)
  To: Zhu Lingshan, qemu-block, qemu-devel; +Cc: pl, ronniesahlberg



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.

Paolo

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] fix:readcapacity 10 failure shown even 16 sent
  2015-12-10  8:55 ` Paolo Bonzini
@ 2015-12-10  8:57   ` Peter Lieven
  2015-12-10  9:08     ` Zhu Lingshan
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Lieven @ 2015-12-10  8:57 UTC (permalink / raw)
  To: Paolo Bonzini, Zhu Lingshan, qemu-block, qemu-devel; +Cc: ronniesahlberg

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] fix:readcapacity 10 failure shown even 16 sent
  2015-12-10  8:57   ` Peter Lieven
@ 2015-12-10  9:08     ` Zhu Lingshan
  0 siblings, 0 replies; 4+ messages in thread
From: Zhu Lingshan @ 2015-12-10  9:08 UTC (permalink / raw)
  To: Peter Lieven, Paolo Bonzini, qemu-block, qemu-devel; +Cc: ronniesahlberg

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
>
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-12-10  9:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-10  2:59 [Qemu-devel] [PATCH] fix:readcapacity 10 failure shown even 16 sent Zhu Lingshan
2015-12-10  8:55 ` Paolo Bonzini
2015-12-10  8:57   ` Peter Lieven
2015-12-10  9:08     ` Zhu Lingshan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).