Skip to content

Commit f087796

Browse files
Dick KennedyDick Kennedy
authored andcommitted
scsi: lpfc: Handle duplicate D_IDs in ndlp search-by D_ID routine
JIRA: https://issues.redhat.com/browse/RHEL-82167 commit 56c3d80 Author: Justin Tee <justin.tee@broadcom.com> Date: Thu Jan 30 16:05:22 2025 -0800 scsi: lpfc: Handle duplicate D_IDs in ndlp search-by D_ID routine After a port swap between separate fabrics, there may be multiple nodes in the vport's fc_nodes list with the same fabric well known address. Duplication is temporary and eventually resolves itself after dev_loss_tmo expires, but nameserver queries may still occur before dev_loss_tmo. This possibly results in returning stale fabric ndlp objects. Fix by adding an nlp_state check to ensure the ndlp search routine returns the correct newer allocated ndlp fabric object. Signed-off-by: Justin Tee <justin.tee@broadcom.com> Link: https://lore.kernel.org/r/20250131000524.163662-5-justintee8345@gmail.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Dick Kennedy <dkennedy@redhat.com>
1 parent 6f1678e commit f087796

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

drivers/scsi/lpfc/lpfc_hbadisc.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5570,6 +5570,7 @@ static struct lpfc_nodelist *
55705570
__lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did)
55715571
{
55725572
struct lpfc_nodelist *ndlp;
5573+
struct lpfc_nodelist *np = NULL;
55735574
uint32_t data1;
55745575

55755576
list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) {
@@ -5584,14 +5585,20 @@ __lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did)
55845585
ndlp, ndlp->nlp_DID,
55855586
ndlp->nlp_flag, data1, ndlp->nlp_rpi,
55865587
ndlp->active_rrqs_xri_bitmap);
5587-
return ndlp;
5588+
5589+
/* Check for new or potentially stale node */
5590+
if (ndlp->nlp_state != NLP_STE_UNUSED_NODE)
5591+
return ndlp;
5592+
np = ndlp;
55885593
}
55895594
}
55905595

5591-
/* FIND node did <did> NOT FOUND */
5592-
lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
5593-
"0932 FIND node did x%x NOT FOUND.\n", did);
5594-
return NULL;
5596+
if (!np)
5597+
/* FIND node did <did> NOT FOUND */
5598+
lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
5599+
"0932 FIND node did x%x NOT FOUND.\n", did);
5600+
5601+
return np;
55955602
}
55965603

55975604
struct lpfc_nodelist *

0 commit comments

Comments
 (0)