On Fri, 2019-06-14 at 15:10 -0700, Himanshu Madhani wrote:
> From: Quinn Tran <qut...@marvell.com>
> 
> - on session delete or chip reset, reject all NVME commands.
> - on NVME command submission error, free srb resource.
> 
> Signed-off-by: Quinn Tran <qut...@marvell.com>
> Signed-off-by: Himanshu Madhani <hmadh...@marvell.com>
> ---
>  drivers/scsi/qla2xxx/qla_nvme.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
> index 99220a3cf734..ead10e1a81fc 100644
> --- a/drivers/scsi/qla2xxx/qla_nvme.c
> +++ b/drivers/scsi/qla2xxx/qla_nvme.c
> @@ -253,6 +253,10 @@ static int qla_nvme_ls_req(struct nvme_fc_local_port 
> *lport,
>  
>       vha = fcport->vha;
>       ha = vha->hw;
> +
> +     if (!ha->flags.fw_started || (fcport && fcport->deleted))
> +             return rval;
> +
>       /* Alloc SRB structure */
>       sp = qla2x00_get_sp(vha, fcport, GFP_ATOMIC);
>       if (!sp)
> @@ -284,6 +288,7 @@ static int qla_nvme_ls_req(struct nvme_fc_local_port 
> *lport,
>                   "qla2x00_start_sp failed = %d\n", rval);
>               atomic_dec(&sp->ref_count);
>               wake_up(&sp->nvme_ls_waitq);
> +             sp->free(sp);
>               return rval;
>       }
>  
> @@ -500,7 +505,7 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port 
> *lport,
>  
>       vha = fcport->vha;
>  
> -     if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags))
> +     if ((qpair && !qpair->fw_started) || (fcport && fcport->deleted))
>               return rval;
>  
>       /*
> @@ -535,6 +540,7 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port 
> *lport,
>                   "qla2x00_start_nvme_mq failed = %d\n", rval);
>               atomic_dec(&sp->ref_count);
>               wake_up(&sp->nvme_ls_waitq);
> +             sp->free(sp);
>       }
>  
>       return rval;
> @@ -561,14 +567,13 @@ static void qla_nvme_remoteport_delete(struct 
> nvme_fc_remote_port *rport)
>  
>       complete(&fcport->nvme_del_done);
>  
> -     if (!test_bit(UNLOADING, &fcport->vha->dpc_flags)) {
> -             INIT_WORK(&fcport->free_work, qlt_free_session_done);
> -             schedule_work(&fcport->free_work);
> -     }
> +     INIT_WORK(&fcport->free_work, qlt_free_session_done);
> +     schedule_work(&fcport->free_work);
>  
>       fcport->nvme_flag &= ~NVME_FLAG_DELETING;
>       ql_log(ql_log_info, fcport->vha, 0x2110,
> -         "remoteport_delete of %p completed.\n", fcport);
> +         "remoteport_delete of %p %8phN completed.\n",
> +         fcport, fcport->port_name);
>  }
>  
>  static struct nvme_fc_port_template qla_nvme_fc_transport = {
> @@ -603,7 +608,8 @@ static void qla_nvme_unregister_remote_port(struct 
> work_struct *work)
>               return;
>  
>       ql_log(ql_log_warn, NULL, 0x2112,
> -         "%s: unregister remoteport on %p\n",__func__, fcport);
> +         "%s: unregister remoteport on %p %8phN\n",
> +         __func__, fcport, fcport->port_name);
>  
>       nvme_fc_set_remoteport_devloss(fcport->nvme_remote_port, 0);
>       init_completion(&fcport->nvme_del_done);

Reviewed-by: Ewan D. Milne <emi...@redhat.com>

Reply via email to