diff mbox series

[08/17] lpfc: Add condition to delete ndlp object after sending BLS_RJT to an ABTS

Message ID 20240131003549.147784-9-justintee8345@gmail.com (mailing list archive)
State Superseded
Headers show
Series lpfc: Update lpfc to revision 14.4.0.0 | expand

Commit Message

Justin Tee Jan. 31, 2024, 12:35 a.m. UTC
The "Nodelist not empty" log message and an accompanying delay may be
observed when deleting an NPIV port or unloading the lpfc driver.  This
can occur due to receipt of an ABTS for which there is no corresponding
login context or ndlp allocated.  In such cases, the driver allocates a new
ndlp object to send a BLS_RJT after which the ndlp object unintentionally
remains in the NLP_STE_UNUSED_NODE state forever.

Add a check to conditionally remove ndlp's initial reference count when
queuing a BLS response.  If the initial reference is removed, then set
the NLP_DROPPED flag to notify other code paths.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
---
 drivers/scsi/lpfc/lpfc_sli.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

Comments

Himanshu Madhani Jan. 31, 2024, 2:39 a.m. UTC | #1
On 1/30/24 16:35, Justin Tee wrote:
> The "Nodelist not empty" log message and an accompanying delay may be
> observed when deleting an NPIV port or unloading the lpfc driver.  This
> can occur due to receipt of an ABTS for which there is no corresponding
> login context or ndlp allocated.  In such cases, the driver allocates a new
> ndlp object to send a BLS_RJT after which the ndlp object unintentionally
> remains in the NLP_STE_UNUSED_NODE state forever.
> 
> Add a check to conditionally remove ndlp's initial reference count when
> queuing a BLS response.  If the initial reference is removed, then set
> the NLP_DROPPED flag to notify other code paths.
> 
> Signed-off-by: Justin Tee <justin.tee@broadcom.com>
> ---
>   drivers/scsi/lpfc/lpfc_sli.c | 14 ++++++++++++--
>   1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
> index c7a2f565e2c2..29fd2eda70d5 100644
> --- a/drivers/scsi/lpfc/lpfc_sli.c
> +++ b/drivers/scsi/lpfc/lpfc_sli.c
> @@ -18933,7 +18933,7 @@ lpfc_sli4_seq_abort_rsp(struct lpfc_vport *vport,
>   					 "oxid:x%x SID:x%x\n", oxid, sid);
>   			return;
>   		}
> -		/* Put ndlp onto pport node list */
> +		/* Put ndlp onto vport node list */
>   		lpfc_enqueue_node(vport, ndlp);
>   	}
>   
> @@ -18953,7 +18953,7 @@ lpfc_sli4_seq_abort_rsp(struct lpfc_vport *vport,
>   		return;
>   	}
>   
> -	ctiocb->vport = phba->pport;
> +	ctiocb->vport = vport;
>   	ctiocb->cmd_cmpl = lpfc_sli4_seq_abort_rsp_cmpl;
>   	ctiocb->sli4_lxritag = NO_XRI;
>   	ctiocb->sli4_xritag = NO_XRI;
> @@ -19040,6 +19040,16 @@ lpfc_sli4_seq_abort_rsp(struct lpfc_vport *vport,
>   		ctiocb->ndlp = NULL;
>   		lpfc_sli_release_iocbq(phba, ctiocb);
>   	}
> +
> +	/* if only usage of this nodelist is BLS response, release initial ref
> +	 * to free ndlp when transmit completes
> +	 */
> +	if (ndlp->nlp_state == NLP_STE_UNUSED_NODE &&
> +	    !(ndlp->nlp_flag & NLP_DROPPED) &&
> +	    !(ndlp->fc4_xpt_flags & (NVME_XPT_REGD | SCSI_XPT_REGD))) {
> +		ndlp->nlp_flag |= NLP_DROPPED;
> +		lpfc_nlp_put(ndlp);
> +	}
>   }
>   
>   /**

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

Patch

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index c7a2f565e2c2..29fd2eda70d5 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -18933,7 +18933,7 @@  lpfc_sli4_seq_abort_rsp(struct lpfc_vport *vport,
 					 "oxid:x%x SID:x%x\n", oxid, sid);
 			return;
 		}
-		/* Put ndlp onto pport node list */
+		/* Put ndlp onto vport node list */
 		lpfc_enqueue_node(vport, ndlp);
 	}
 
@@ -18953,7 +18953,7 @@  lpfc_sli4_seq_abort_rsp(struct lpfc_vport *vport,
 		return;
 	}
 
-	ctiocb->vport = phba->pport;
+	ctiocb->vport = vport;
 	ctiocb->cmd_cmpl = lpfc_sli4_seq_abort_rsp_cmpl;
 	ctiocb->sli4_lxritag = NO_XRI;
 	ctiocb->sli4_xritag = NO_XRI;
@@ -19040,6 +19040,16 @@  lpfc_sli4_seq_abort_rsp(struct lpfc_vport *vport,
 		ctiocb->ndlp = NULL;
 		lpfc_sli_release_iocbq(phba, ctiocb);
 	}
+
+	/* if only usage of this nodelist is BLS response, release initial ref
+	 * to free ndlp when transmit completes
+	 */
+	if (ndlp->nlp_state == NLP_STE_UNUSED_NODE &&
+	    !(ndlp->nlp_flag & NLP_DROPPED) &&
+	    !(ndlp->fc4_xpt_flags & (NVME_XPT_REGD | SCSI_XPT_REGD))) {
+		ndlp->nlp_flag |= NLP_DROPPED;
+		lpfc_nlp_put(ndlp);
+	}
 }
 
 /**