Skip to content

Commit 900db34

Browse files
Justin Teemartinkpetersen
authored andcommitted
scsi: lpfc: Add condition to delete ndlp object after sending BLS_RJT to an ABTS
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> Link: https://lore.kernel.org/r/20240131185112.149731-9-justintee8345@gmail.com Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 7bb6cb7 commit 900db34

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

drivers/scsi/lpfc/lpfc_sli.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18933,7 +18933,7 @@ lpfc_sli4_seq_abort_rsp(struct lpfc_vport *vport,
1893318933
"oxid:x%x SID:x%x\n", oxid, sid);
1893418934
return;
1893518935
}
18936-
/* Put ndlp onto pport node list */
18936+
/* Put ndlp onto vport node list */
1893718937
lpfc_enqueue_node(vport, ndlp);
1893818938
}
1893918939

@@ -18953,7 +18953,7 @@ lpfc_sli4_seq_abort_rsp(struct lpfc_vport *vport,
1895318953
return;
1895418954
}
1895518955

18956-
ctiocb->vport = phba->pport;
18956+
ctiocb->vport = vport;
1895718957
ctiocb->cmd_cmpl = lpfc_sli4_seq_abort_rsp_cmpl;
1895818958
ctiocb->sli4_lxritag = NO_XRI;
1895918959
ctiocb->sli4_xritag = NO_XRI;
@@ -19040,6 +19040,16 @@ lpfc_sli4_seq_abort_rsp(struct lpfc_vport *vport,
1904019040
ctiocb->ndlp = NULL;
1904119041
lpfc_sli_release_iocbq(phba, ctiocb);
1904219042
}
19043+
19044+
/* if only usage of this nodelist is BLS response, release initial ref
19045+
* to free ndlp when transmit completes
19046+
*/
19047+
if (ndlp->nlp_state == NLP_STE_UNUSED_NODE &&
19048+
!(ndlp->nlp_flag & NLP_DROPPED) &&
19049+
!(ndlp->fc4_xpt_flags & (NVME_XPT_REGD | SCSI_XPT_REGD))) {
19050+
ndlp->nlp_flag |= NLP_DROPPED;
19051+
lpfc_nlp_put(ndlp);
19052+
}
1904319053
}
1904419054

1904519055
/**

0 commit comments

Comments
 (0)