]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
scsi: lpfc: Modify kref handling for Fabric Controller ndlps
authorJustin Tee <justin.tee@broadcom.com>
Thu, 6 Nov 2025 22:46:35 +0000 (14:46 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sat, 8 Nov 2025 18:18:00 +0000 (13:18 -0500)
commit0b8b15a0b74dafe4b184dfae120d715172960ae5
treecb7e755ab8b136ee5ca9b502aba7c6c12853424d
parent23f4906729a0064e734fb9da2ed02e8fbbf8db00
scsi: lpfc: Modify kref handling for Fabric Controller ndlps

Currently, there is a kref put in the lpfc_cleanup() routine that takes
care of outstanding references on fabric controller ndlps in UNUSED
state.  While typically there is a state change from UNUSED -> REGLOGIN
when the ndlp successfully logs into the fabric, there may be cases when
FLOGI is unsuccessful and the ndlp will remain in UNUSED state without a
registered rpi, yet the ndlp incorrectly has a kref count of one.

To address this, handling of Fabric Controller ndlps are moved into the
routines: lpfc_issue_els_scr(), lpfc_issue_els_rdf(),
lpfc_cmpl_els_disc_cmd().

In both lpfc_issue_els_scr() and lpfc_issue_els_rdf(), if there does not
exist a previously created fabric controller ndlp, an ndlp will be
created.  Otherwise, we can reuse the pre-existing ndlp object.

In lpfc_cmpl_els_disc_cmd(), if the SCR or RDF are not successfully
issued, the initial reference on the ndlp that is not registered with
upper layers will be decremented with a kref_put().

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://patch.msgid.link/20251106224639.139176-7-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_els.c
drivers/scsi/lpfc/lpfc_init.c