Skip to content

Commit f980c10

Browse files
Justin Teejfvogel
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]> (cherry picked from commit 56c3d809b7b450379162d0b8a70bbe71ab8db706) Orabug: 37603756 Signed-off-by: Harshit Mogalapalli <[email protected]> Reviewed-by: Jack Vogel <[email protected]>
1 parent 65690a3 commit f980c10

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)