All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bnx2fc: timeout calculation invalid for bnx2fc_eh_abort()
@ 2019-11-19 15:46 Laurence Oberman
  2019-11-20  3:14 ` cdupuis1
  2019-11-20  3:32 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Laurence Oberman @ 2019-11-19 15:46 UTC (permalink / raw)
  To: QLogic-Storage-Upstream, linux-scsi, djeffery, jpittman, cdupuis1
  Cc: Laurence Oberman

In the bnx2fc_eh_abort() function there is a calculation for
wait_for_completion that uses a HZ multiplier.
This is incorrect, it scales the timeout by 1000 seconds
instead of converting the ms value to jiffies.
Therefore change the calculation.

Reported-by: David Jeffery <djeffery@redhat.com>
Reviewed-by: John Pittman .jpittman@redhat.com>
Signed-off-by: Laurence Oberman <loberman@redhat.com>
---
 drivers/scsi/bnx2fc/bnx2fc_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index 401743e..d8ae6d0 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -1242,7 +1242,7 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)
 
 	/* Wait 2 * RA_TOV + 1 to be sure timeout function hasn't fired */
 	time_left = wait_for_completion_timeout(&io_req->abts_done,
-						(2 * rp->r_a_tov + 1) * HZ);
+					msecs_to_jiffies(2 * rp->r_a_tov + 1));
 	if (time_left)
 		BNX2FC_IO_DBG(io_req,
 			      "Timed out in eh_abort waiting for abts_done");
-- 
1.8.3.1


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

* Re: [PATCH] bnx2fc: timeout calculation invalid for bnx2fc_eh_abort()
  2019-11-19 15:46 [PATCH] bnx2fc: timeout calculation invalid for bnx2fc_eh_abort() Laurence Oberman
@ 2019-11-20  3:14 ` cdupuis1
  2019-11-20  3:32 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: cdupuis1 @ 2019-11-20  3:14 UTC (permalink / raw)
  To: Laurence Oberman, QLogic-Storage-Upstream, linux-scsi, djeffery,
	jpittman

Looks like the original calculation assumed that rp->r_a_tov was
specified in seconds hence the HZ multiplier.  Converting using
msecs_to_jiffies() would seem to be the correct way to do it.

Reviewed-by: Chad Dupuis <cdupuis1@gmail.com>

On Tue, 2019-11-19 at 10:46 -0500, Laurence Oberman wrote:
> In the bnx2fc_eh_abort() function there is a calculation for
> wait_for_completion that uses a HZ multiplier.
> This is incorrect, it scales the timeout by 1000 seconds
> instead of converting the ms value to jiffies.
> Therefore change the calculation.
> 
> Reported-by: David Jeffery <djeffery@redhat.com>
> Reviewed-by: John Pittman .jpittman@redhat.com>
> Signed-off-by: Laurence Oberman <loberman@redhat.com>
> ---
>  drivers/scsi/bnx2fc/bnx2fc_io.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c
> b/drivers/scsi/bnx2fc/bnx2fc_io.c
> index 401743e..d8ae6d0 100644
> --- a/drivers/scsi/bnx2fc/bnx2fc_io.c
> +++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
> @@ -1242,7 +1242,7 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)
>  
>  	/* Wait 2 * RA_TOV + 1 to be sure timeout function hasn't fired
> */
>  	time_left = wait_for_completion_timeout(&io_req->abts_done,
> -						(2 * rp->r_a_tov + 1) *
> HZ);
> +					msecs_to_jiffies(2 * rp-
> >r_a_tov + 1));
>  	if (time_left)
>  		BNX2FC_IO_DBG(io_req,
>  			      "Timed out in eh_abort waiting for
> abts_done");


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

* Re: [PATCH] bnx2fc: timeout calculation invalid for bnx2fc_eh_abort()
  2019-11-19 15:46 [PATCH] bnx2fc: timeout calculation invalid for bnx2fc_eh_abort() Laurence Oberman
  2019-11-20  3:14 ` cdupuis1
@ 2019-11-20  3:32 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2019-11-20  3:32 UTC (permalink / raw)
  To: Laurence Oberman
  Cc: QLogic-Storage-Upstream, linux-scsi, djeffery, jpittman, cdupuis1


Laurence,

> In the bnx2fc_eh_abort() function there is a calculation for
> wait_for_completion that uses a HZ multiplier.  This is incorrect, it
> scales the timeout by 1000 seconds instead of converting the ms value
> to jiffies.  Therefore change the calculation.

Applied to 5.5/scsi-queue, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2019-11-20  3:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-19 15:46 [PATCH] bnx2fc: timeout calculation invalid for bnx2fc_eh_abort() Laurence Oberman
2019-11-20  3:14 ` cdupuis1
2019-11-20  3:32 ` Martin K. Petersen

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.