Skip to content

Commit d83ca3e

Browse files
jsmart-ghmartinkpetersen
authored andcommitted
scsi: lpfc: Correct loss of fc4 type on remote port address change
An address change for a remote port cause PRLI for the wrong protocol to be sent. The node copy done in the discovery code skipped copying the fc4 protocols supported as well. Fix the copy logic for the address change. Beefed up log messages in this area as well. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <jsmart2021@gmail.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent d496b9a commit d83ca3e

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

drivers/scsi/lpfc/lpfc_els.c

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,8 +1556,10 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp,
15561556
*/
15571557
new_ndlp = lpfc_findnode_wwpn(vport, &sp->portName);
15581558

1559+
/* return immediately if the WWPN matches ndlp */
15591560
if (new_ndlp == ndlp && NLP_CHK_NODE_ACT(new_ndlp))
15601561
return ndlp;
1562+
15611563
if (phba->sli_rev == LPFC_SLI_REV4) {
15621564
active_rrqs_xri_bitmap = mempool_alloc(phba->active_rrq_pool,
15631565
GFP_KERNEL);
@@ -1566,9 +1568,13 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp,
15661568
phba->cfg_rrq_xri_bitmap_sz);
15671569
}
15681570

1569-
lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
1570-
"3178 PLOGI confirm: ndlp %p x%x: new_ndlp %p\n",
1571-
ndlp, ndlp->nlp_DID, new_ndlp);
1571+
lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS | LOG_NODE,
1572+
"3178 PLOGI confirm: ndlp x%x x%x x%x: "
1573+
"new_ndlp x%x x%x x%x\n",
1574+
ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_fc4_type,
1575+
(new_ndlp ? new_ndlp->nlp_DID : 0),
1576+
(new_ndlp ? new_ndlp->nlp_flag : 0),
1577+
(new_ndlp ? new_ndlp->nlp_fc4_type : 0));
15721578

15731579
if (!new_ndlp) {
15741580
rc = memcmp(&ndlp->nlp_portname, name,
@@ -1617,6 +1623,14 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp,
16171623
phba->cfg_rrq_xri_bitmap_sz);
16181624
}
16191625

1626+
/* At this point in this routine, we know new_ndlp will be
1627+
* returned. however, any previous GID_FTs that were done
1628+
* would have updated nlp_fc4_type in ndlp, so we must ensure
1629+
* new_ndlp has the right value.
1630+
*/
1631+
if (vport->fc_flag & FC_FABRIC)
1632+
new_ndlp->nlp_fc4_type = ndlp->nlp_fc4_type;
1633+
16201634
lpfc_unreg_rpi(vport, new_ndlp);
16211635
new_ndlp->nlp_DID = ndlp->nlp_DID;
16221636
new_ndlp->nlp_prev_state = ndlp->nlp_prev_state;
@@ -1666,7 +1680,6 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp,
16661680
if (ndlp->nrport) {
16671681
ndlp->nrport = NULL;
16681682
lpfc_nlp_put(ndlp);
1669-
new_ndlp->nlp_fc4_type = ndlp->nlp_fc4_type;
16701683
}
16711684

16721685
/* We shall actually free the ndlp with both nlp_DID and
@@ -1740,6 +1753,12 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp,
17401753
active_rrqs_xri_bitmap)
17411754
mempool_free(active_rrqs_xri_bitmap,
17421755
phba->active_rrq_pool);
1756+
1757+
lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS | LOG_NODE,
1758+
"3173 PLOGI confirm exit: new_ndlp x%x x%x x%x\n",
1759+
new_ndlp->nlp_DID, new_ndlp->nlp_flag,
1760+
new_ndlp->nlp_fc4_type);
1761+
17431762
return new_ndlp;
17441763
}
17451764

drivers/scsi/lpfc/lpfc_nportdisc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2868,8 +2868,9 @@ lpfc_disc_state_machine(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
28682868
/* DSM in event <evt> on NPort <nlp_DID> in state <cur_state> */
28692869
lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
28702870
"0211 DSM in event x%x on NPort x%x in "
2871-
"state %d Data: x%x\n",
2872-
evt, ndlp->nlp_DID, cur_state, ndlp->nlp_flag);
2871+
"state %d Data: x%x x%x\n",
2872+
evt, ndlp->nlp_DID, cur_state,
2873+
ndlp->nlp_flag, ndlp->nlp_fc4_type);
28732874

28742875
lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_DSM,
28752876
"DSM in: evt:%d ste:%d did:x%x",

0 commit comments

Comments
 (0)