All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qla2xxx: Add qla2x00_async_done routine for async routines.
@ 2022-02-08  9:39 Nilesh Javali
  2022-02-08 17:34 ` Himanshu Madhani
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Nilesh Javali @ 2022-02-08  9:39 UTC (permalink / raw)
  To: martin.petersen; +Cc: linux-scsi, GR-QLogic-Storage-Upstream, emilne

From: Saurav Kashyap <skashyap@marvell.com>

This done routine will delete the timer and check for it's return
value and accordingly decrease the reference count.

Fixes: 31e6cdbe0eae ("scsi: qla2xxx: Implement ref count for SRB")
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
---
 drivers/scsi/qla2xxx/qla_iocb.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 7dd82214d59f..5e3ee1f7b43c 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -2560,6 +2560,20 @@ qla24xx_tm_iocb(srb_t *sp, struct tsk_mgmt_entry *tsk)
 	}
 }
 
+static void
+qla2x00_async_done(struct srb *sp, int res)
+{
+	if (del_timer(&sp->u.iocb_cmd.timer)) {
+		/*
+		 * Successfully cancelled the timeout handler
+		 * ref: TMR
+		 */
+		if (kref_put(&sp->cmd_kref, qla2x00_sp_release))
+			return;
+	}
+	sp->async_done(sp, res);
+}
+
 void
 qla2x00_sp_release(struct kref *kref)
 {
@@ -2573,7 +2587,8 @@ qla2x00_init_async_sp(srb_t *sp, unsigned long tmo,
 		     void (*done)(struct srb *sp, int res))
 {
 	timer_setup(&sp->u.iocb_cmd.timer, qla2x00_sp_timeout, 0);
-	sp->done = done;
+	sp->done = qla2x00_async_done;
+	sp->async_done = done;
 	sp->free = qla2x00_sp_free;
 	sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout;
 	sp->u.iocb_cmd.timer.expires = jiffies + tmo * HZ;
-- 
2.23.1


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

* Re: [PATCH] qla2xxx: Add qla2x00_async_done routine for async routines.
  2022-02-08  9:39 [PATCH] qla2xxx: Add qla2x00_async_done routine for async routines Nilesh Javali
@ 2022-02-08 17:34 ` Himanshu Madhani
  2022-02-09 20:09 ` Ewan Milne
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Himanshu Madhani @ 2022-02-08 17:34 UTC (permalink / raw)
  To: Nilesh Javali
  Cc: Martin Petersen, linux-scsi, GR-QLogic-Storage-Upstream, emilne



> On Feb 8, 2022, at 1:39 AM, Nilesh Javali <njavali@marvell.com> wrote:
> 
> From: Saurav Kashyap <skashyap@marvell.com>
> 
> This done routine will delete the timer and check for it's return
> value and accordingly decrease the reference count.
> 
> Fixes: 31e6cdbe0eae ("scsi: qla2xxx: Implement ref count for SRB")
> Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
> Signed-off-by: Nilesh Javali <njavali@marvell.com>

FYI…  You should add 

Reported-by: Ewan Milne <emilne@redhat.com>

> ---
> drivers/scsi/qla2xxx/qla_iocb.c | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
> index 7dd82214d59f..5e3ee1f7b43c 100644
> --- a/drivers/scsi/qla2xxx/qla_iocb.c
> +++ b/drivers/scsi/qla2xxx/qla_iocb.c
> @@ -2560,6 +2560,20 @@ qla24xx_tm_iocb(srb_t *sp, struct tsk_mgmt_entry *tsk)
> 	}
> }
> 
> +static void
> +qla2x00_async_done(struct srb *sp, int res)
> +{
> +	if (del_timer(&sp->u.iocb_cmd.timer)) {
> +		/*
> +		 * Successfully cancelled the timeout handler
> +		 * ref: TMR
> +		 */
> +		if (kref_put(&sp->cmd_kref, qla2x00_sp_release))
> +			return;
> +	}
> +	sp->async_done(sp, res);
> +}
> +
> void
> qla2x00_sp_release(struct kref *kref)
> {
> @@ -2573,7 +2587,8 @@ qla2x00_init_async_sp(srb_t *sp, unsigned long tmo,
> 		     void (*done)(struct srb *sp, int res))
> {
> 	timer_setup(&sp->u.iocb_cmd.timer, qla2x00_sp_timeout, 0);
> -	sp->done = done;
> +	sp->done = qla2x00_async_done;
> +	sp->async_done = done;
> 	sp->free = qla2x00_sp_free;
> 	sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout;
> 	sp->u.iocb_cmd.timer.expires = jiffies + tmo * HZ;
> -- 
> 2.23.1
> 

Looks Good. 

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>

--
Himanshu Madhani	 Oracle Linux Engineering


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

* Re: [PATCH] qla2xxx: Add qla2x00_async_done routine for async routines.
  2022-02-08  9:39 [PATCH] qla2xxx: Add qla2x00_async_done routine for async routines Nilesh Javali
  2022-02-08 17:34 ` Himanshu Madhani
@ 2022-02-09 20:09 ` Ewan Milne
  2022-02-10  3:54   ` Saurav Kashyap
  2022-02-11 21:37 ` Martin K. Petersen
  2022-02-15  3:19 ` Martin K. Petersen
  3 siblings, 1 reply; 6+ messages in thread
From: Ewan Milne @ 2022-02-09 20:09 UTC (permalink / raw)
  To: Nilesh Javali; +Cc: Martin K. Petersen, linux-scsi, GR-QLogic-Storage-Upstream

Thanks, that appears to have resolved the crash on boot I was seeing.

Tested-by: Ewan D. Milne <emilne@redhat.com>

On Tue, Feb 8, 2022 at 4:40 AM Nilesh Javali <njavali@marvell.com> wrote:
>
> From: Saurav Kashyap <skashyap@marvell.com>
>
> This done routine will delete the timer and check for it's return
> value and accordingly decrease the reference count.
>
> Fixes: 31e6cdbe0eae ("scsi: qla2xxx: Implement ref count for SRB")
> Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
> Signed-off-by: Nilesh Javali <njavali@marvell.com>
> ---
>  drivers/scsi/qla2xxx/qla_iocb.c | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
> index 7dd82214d59f..5e3ee1f7b43c 100644
> --- a/drivers/scsi/qla2xxx/qla_iocb.c
> +++ b/drivers/scsi/qla2xxx/qla_iocb.c
> @@ -2560,6 +2560,20 @@ qla24xx_tm_iocb(srb_t *sp, struct tsk_mgmt_entry *tsk)
>         }
>  }
>
> +static void
> +qla2x00_async_done(struct srb *sp, int res)
> +{
> +       if (del_timer(&sp->u.iocb_cmd.timer)) {
> +               /*
> +                * Successfully cancelled the timeout handler
> +                * ref: TMR
> +                */
> +               if (kref_put(&sp->cmd_kref, qla2x00_sp_release))
> +                       return;
> +       }
> +       sp->async_done(sp, res);
> +}
> +
>  void
>  qla2x00_sp_release(struct kref *kref)
>  {
> @@ -2573,7 +2587,8 @@ qla2x00_init_async_sp(srb_t *sp, unsigned long tmo,
>                      void (*done)(struct srb *sp, int res))
>  {
>         timer_setup(&sp->u.iocb_cmd.timer, qla2x00_sp_timeout, 0);
> -       sp->done = done;
> +       sp->done = qla2x00_async_done;
> +       sp->async_done = done;
>         sp->free = qla2x00_sp_free;
>         sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout;
>         sp->u.iocb_cmd.timer.expires = jiffies + tmo * HZ;
> --
> 2.23.1
>


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

* RE: [PATCH] qla2xxx: Add qla2x00_async_done routine for async routines.
  2022-02-09 20:09 ` Ewan Milne
@ 2022-02-10  3:54   ` Saurav Kashyap
  0 siblings, 0 replies; 6+ messages in thread
From: Saurav Kashyap @ 2022-02-10  3:54 UTC (permalink / raw)
  To: Ewan Milne, Nilesh Javali
  Cc: Martin K. Petersen, linux-scsi, GR-QLogic-Storage-Upstream

Hi Ewan,
Thanks a lot for an update.

Hi Martin,
Can this be merged to original patch? 
Fixes: 31e6cdbe0eae ("scsi: qla2xxx: Implement ref count for SRB")

Thanks,
~Saurav

> -----Original Message-----
> From: Ewan Milne <emilne@redhat.com>
> Sent: Thursday, February 10, 2022 1:39 AM
> To: Nilesh Javali <njavali@marvell.com>
> Cc: Martin K. Petersen <martin.petersen@oracle.com>; linux-
> scsi@vger.kernel.org; GR-QLogic-Storage-Upstream <GR-QLogic-Storage-
> Upstream@marvell.com>
> Subject: Re: [PATCH] qla2xxx: Add qla2x00_async_done routine for async
> routines.
> 
> Thanks, that appears to have resolved the crash on boot I was seeing.
> 
> Tested-by: Ewan D. Milne <emilne@redhat.com>
> 
> On Tue, Feb 8, 2022 at 4:40 AM Nilesh Javali <njavali@marvell.com> wrote:
> >
> > From: Saurav Kashyap <skashyap@marvell.com>
> >
> > This done routine will delete the timer and check for it's return
> > value and accordingly decrease the reference count.
> >
> > Fixes: 31e6cdbe0eae ("scsi: qla2xxx: Implement ref count for SRB")
> > Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
> > Signed-off-by: Nilesh Javali <njavali@marvell.com>
> > ---
> >  drivers/scsi/qla2xxx/qla_iocb.c | 17 ++++++++++++++++-
> >  1 file changed, 16 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
> > index 7dd82214d59f..5e3ee1f7b43c 100644
> > --- a/drivers/scsi/qla2xxx/qla_iocb.c
> > +++ b/drivers/scsi/qla2xxx/qla_iocb.c
> > @@ -2560,6 +2560,20 @@ qla24xx_tm_iocb(srb_t *sp, struct
> tsk_mgmt_entry *tsk)
> >         }
> >  }
> >
> > +static void
> > +qla2x00_async_done(struct srb *sp, int res)
> > +{
> > +       if (del_timer(&sp->u.iocb_cmd.timer)) {
> > +               /*
> > +                * Successfully cancelled the timeout handler
> > +                * ref: TMR
> > +                */
> > +               if (kref_put(&sp->cmd_kref, qla2x00_sp_release))
> > +                       return;
> > +       }
> > +       sp->async_done(sp, res);
> > +}
> > +
> >  void
> >  qla2x00_sp_release(struct kref *kref)
> >  {
> > @@ -2573,7 +2587,8 @@ qla2x00_init_async_sp(srb_t *sp, unsigned long
> tmo,
> >                      void (*done)(struct srb *sp, int res))
> >  {
> >         timer_setup(&sp->u.iocb_cmd.timer, qla2x00_sp_timeout, 0);
> > -       sp->done = done;
> > +       sp->done = qla2x00_async_done;
> > +       sp->async_done = done;
> >         sp->free = qla2x00_sp_free;
> >         sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout;
> >         sp->u.iocb_cmd.timer.expires = jiffies + tmo * HZ;
> > --
> > 2.23.1
> >


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

* Re: [PATCH] qla2xxx: Add qla2x00_async_done routine for async routines.
  2022-02-08  9:39 [PATCH] qla2xxx: Add qla2x00_async_done routine for async routines Nilesh Javali
  2022-02-08 17:34 ` Himanshu Madhani
  2022-02-09 20:09 ` Ewan Milne
@ 2022-02-11 21:37 ` Martin K. Petersen
  2022-02-15  3:19 ` Martin K. Petersen
  3 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2022-02-11 21:37 UTC (permalink / raw)
  To: Nilesh Javali
  Cc: martin.petersen, linux-scsi, GR-QLogic-Storage-Upstream, emilne


Nilesh,

> This done routine will delete the timer and check for it's return
> value and accordingly decrease the reference count.

Applied to 5.18/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH] qla2xxx: Add qla2x00_async_done routine for async routines.
  2022-02-08  9:39 [PATCH] qla2xxx: Add qla2x00_async_done routine for async routines Nilesh Javali
                   ` (2 preceding siblings ...)
  2022-02-11 21:37 ` Martin K. Petersen
@ 2022-02-15  3:19 ` Martin K. Petersen
  3 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2022-02-15  3:19 UTC (permalink / raw)
  To: Nilesh Javali
  Cc: Martin K . Petersen, emilne, linux-scsi, GR-QLogic-Storage-Upstream

On Tue, 8 Feb 2022 01:39:46 -0800, Nilesh Javali wrote:

> From: Saurav Kashyap <skashyap@marvell.com>
> 
> This done routine will delete the timer and check for it's return
> value and accordingly decrease the reference count.
> 
> 

Applied to 5.18/scsi-queue, thanks!

[1/1] qla2xxx: Add qla2x00_async_done routine for async routines.
      https://git.kernel.org/mkp/scsi/c/49b729f58e7a

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2022-02-15  3:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-08  9:39 [PATCH] qla2xxx: Add qla2x00_async_done routine for async routines Nilesh Javali
2022-02-08 17:34 ` Himanshu Madhani
2022-02-09 20:09 ` Ewan Milne
2022-02-10  3:54   ` Saurav Kashyap
2022-02-11 21:37 ` Martin K. Petersen
2022-02-15  3:19 ` 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.