Skip to content

Commit 65690a3

Browse files
Justin Teejfvogel
authored andcommitted
scsi: lpfc: Ignore ndlp rport mismatch in dev_loss_tmo callbk
With repeated port swaps between separate fabrics, there can be multiple registrations for fabric well known address 0xfffffe. This can cause ndlp reference confusion due to the usage of a single ndlp ptr that stores the rport object in fc_rport struct private storage during transport registration. Subsequent registrations update the ndlp->rport field with the newer rport, so when transport layer triggers dev_loss_tmo for the earlier registered rport the ndlp->rport private storage is referencing the newer rport instead of the older rport in dev_loss_tmo callbk. Because the older ndlp->rport object is already cleaned up elsewhere in driver code during the time of fabric swap, check that the rport provided in dev_loss_tmo callbk actually matches the rport stored in the LLDD's ndlp->rport field. Otherwise, skip dev_loss_tmo work on a stale rport. 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 23ed62897746f49f195d819ce6edeb1db27d1b72) Orabug: 37603756 Signed-off-by: Harshit Mogalapalli <[email protected]> Reviewed-by: Jack Vogel <[email protected]>
1 parent f22b425 commit 65690a3

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

drivers/scsi/lpfc/lpfc_hbadisc.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,16 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport)
228228
if (ndlp->nlp_state == NLP_STE_MAPPED_NODE)
229229
return;
230230

231-
/* check for recovered fabric node */
232-
if (ndlp->nlp_state == NLP_STE_UNMAPPED_NODE &&
233-
ndlp->nlp_DID == Fabric_DID)
231+
/* Ignore callback for a mismatched (stale) rport */
232+
if (ndlp->rport != rport) {
233+
lpfc_vlog_msg(vport, KERN_WARNING, LOG_NODE,
234+
"6788 fc rport mismatch: d_id x%06x ndlp x%px "
235+
"fc rport x%px node rport x%px state x%x "
236+
"refcnt %u\n",
237+
ndlp->nlp_DID, ndlp, rport, ndlp->rport,
238+
ndlp->nlp_state, kref_read(&ndlp->kref));
234239
return;
240+
}
235241

236242
if (rport->port_name != wwn_to_u64(ndlp->nlp_portname.u.wwn))
237243
lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,

0 commit comments

Comments
 (0)