* [PATCH] scsi: return correct status in scsi_host_eh_past_deadline()
@ 2020-02-04 10:23 Hannes Reinecke
2020-02-04 14:27 ` Laurence Oberman
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Hannes Reinecke @ 2020-02-04 10:23 UTC (permalink / raw)
To: Martin K. Petersen
Cc: Christoph Hellwig, James Bottomley, linux-scsi, Hannes Reinecke
If the user changed the 'eh_deadline' setting to 'off' while evaluating
the time_before() call we will return 'true', which is inconsistent
with the first conditional, where we return 'false' if 'eh_deadline'
is set to 'off'.
Reported-by: Martin Wilck <martin.wilck@suse.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
drivers/scsi/scsi_error.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index ae2fa170f6ad..ae29a9b4af56 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -113,7 +113,7 @@ static int scsi_host_eh_past_deadline(struct Scsi_Host *shost)
shost->eh_deadline > -1)
return 0;
- return 1;
+ return shost->eh_deadline == -1 ? 0 : 1;
}
/**
--
2.16.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] scsi: return correct status in scsi_host_eh_past_deadline()
2020-02-04 10:23 [PATCH] scsi: return correct status in scsi_host_eh_past_deadline() Hannes Reinecke
@ 2020-02-04 14:27 ` Laurence Oberman
2020-02-04 21:54 ` Ewan D. Milne
2020-02-04 23:22 ` Bart Van Assche
2 siblings, 0 replies; 5+ messages in thread
From: Laurence Oberman @ 2020-02-04 14:27 UTC (permalink / raw)
To: Hannes Reinecke, Martin K. Petersen
Cc: Christoph Hellwig, James Bottomley, linux-scsi
On Tue, 2020-02-04 at 11:23 +0100, Hannes Reinecke wrote:
> If the user changed the 'eh_deadline' setting to 'off' while
> evaluating
> the time_before() call we will return 'true', which is inconsistent
> with the first conditional, where we return 'false' if 'eh_deadline'
> is set to 'off'.
>
> Reported-by: Martin Wilck <martin.wilck@suse.com>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
> drivers/scsi/scsi_error.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
> index ae2fa170f6ad..ae29a9b4af56 100644
> --- a/drivers/scsi/scsi_error.c
> +++ b/drivers/scsi/scsi_error.c
> @@ -113,7 +113,7 @@ static int scsi_host_eh_past_deadline(struct
> Scsi_Host *shost)
> shost->eh_deadline > -1)
> return 0;
>
> - return 1;
> + return shost->eh_deadline == -1 ? 0 : 1;
> }
>
> /**
Makes sense, looks right to me.
Reviewed-by: Laurence Oberman <loberman@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] scsi: return correct status in scsi_host_eh_past_deadline()
2020-02-04 10:23 [PATCH] scsi: return correct status in scsi_host_eh_past_deadline() Hannes Reinecke
2020-02-04 14:27 ` Laurence Oberman
@ 2020-02-04 21:54 ` Ewan D. Milne
2020-02-04 23:24 ` Bart Van Assche
2020-02-04 23:22 ` Bart Van Assche
2 siblings, 1 reply; 5+ messages in thread
From: Ewan D. Milne @ 2020-02-04 21:54 UTC (permalink / raw)
To: Hannes Reinecke, Martin K. Petersen
Cc: Christoph Hellwig, James Bottomley, linux-scsi
On Tue, 2020-02-04 at 11:23 +0100, Hannes Reinecke wrote:
> If the user changed the 'eh_deadline' setting to 'off' while evaluating
> the time_before() call we will return 'true', which is inconsistent
> with the first conditional, where we return 'false' if 'eh_deadline'
> is set to 'off'.
>
> Reported-by: Martin Wilck <martin.wilck@suse.com>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
> drivers/scsi/scsi_error.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
> index ae2fa170f6ad..ae29a9b4af56 100644
> --- a/drivers/scsi/scsi_error.c
> +++ b/drivers/scsi/scsi_error.c
> @@ -113,7 +113,7 @@ static int scsi_host_eh_past_deadline(struct Scsi_Host *shost)
> shost->eh_deadline > -1)
> return 0;
>
> - return 1;
> + return shost->eh_deadline == -1 ? 0 : 1;
> }
>
> /**
Hmm. 4 accesses to shost->eh_deadline in the function?
Why don't we just copy it to a local variable and use that.
-Ewan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] scsi: return correct status in scsi_host_eh_past_deadline()
2020-02-04 10:23 [PATCH] scsi: return correct status in scsi_host_eh_past_deadline() Hannes Reinecke
2020-02-04 14:27 ` Laurence Oberman
2020-02-04 21:54 ` Ewan D. Milne
@ 2020-02-04 23:22 ` Bart Van Assche
2 siblings, 0 replies; 5+ messages in thread
From: Bart Van Assche @ 2020-02-04 23:22 UTC (permalink / raw)
To: Hannes Reinecke, Martin K. Petersen
Cc: Christoph Hellwig, James Bottomley, linux-scsi
On 2/4/20 2:23 AM, Hannes Reinecke wrote:
> If the user changed the 'eh_deadline' setting to 'off' while evaluating
> the time_before() call we will return 'true', which is inconsistent
> with the first conditional, where we return 'false' if 'eh_deadline'
> is set to 'off'.
>
> Reported-by: Martin Wilck <martin.wilck@suse.com>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
> drivers/scsi/scsi_error.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
> index ae2fa170f6ad..ae29a9b4af56 100644
> --- a/drivers/scsi/scsi_error.c
> +++ b/drivers/scsi/scsi_error.c
> @@ -113,7 +113,7 @@ static int scsi_host_eh_past_deadline(struct Scsi_Host *shost)
> shost->eh_deadline > -1)
> return 0;
>
> - return 1;
> + return shost->eh_deadline == -1 ? 0 : 1;
> }
This seems like a good opportunity to change the return type of this
function from 'int' into 'bool'?
Thanks,
Bart.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] scsi: return correct status in scsi_host_eh_past_deadline()
2020-02-04 21:54 ` Ewan D. Milne
@ 2020-02-04 23:24 ` Bart Van Assche
0 siblings, 0 replies; 5+ messages in thread
From: Bart Van Assche @ 2020-02-04 23:24 UTC (permalink / raw)
To: Ewan D. Milne, Hannes Reinecke, Martin K. Petersen
Cc: Christoph Hellwig, James Bottomley, linux-scsi
On 2/4/20 1:54 PM, Ewan D. Milne wrote:
> On Tue, 2020-02-04 at 11:23 +0100, Hannes Reinecke wrote:
>> If the user changed the 'eh_deadline' setting to 'off' while evaluating
>> the time_before() call we will return 'true', which is inconsistent
>> with the first conditional, where we return 'false' if 'eh_deadline'
>> is set to 'off'.
>>
>> Reported-by: Martin Wilck <martin.wilck@suse.com>
>> Signed-off-by: Hannes Reinecke <hare@suse.de>
>> ---
>> drivers/scsi/scsi_error.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
>> index ae2fa170f6ad..ae29a9b4af56 100644
>> --- a/drivers/scsi/scsi_error.c
>> +++ b/drivers/scsi/scsi_error.c
>> @@ -113,7 +113,7 @@ static int scsi_host_eh_past_deadline(struct Scsi_Host *shost)
>> shost->eh_deadline > -1)
>> return 0;
>>
>> - return 1;
>> + return shost->eh_deadline == -1 ? 0 : 1;
>> }
>>
>> /**
>
> Hmm. 4 accesses to shost->eh_deadline in the function?
> Why don't we just copy it to a local variable and use that.
That sounds like a better solution to me and that would also fix the
problem described by Hannes.
Bart.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-02-04 23:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04 10:23 [PATCH] scsi: return correct status in scsi_host_eh_past_deadline() Hannes Reinecke
2020-02-04 14:27 ` Laurence Oberman
2020-02-04 21:54 ` Ewan D. Milne
2020-02-04 23:24 ` Bart Van Assche
2020-02-04 23:22 ` Bart Van Assche
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.