diff mbox series

[4/8] lpfc: Fix unintentional double clearing of vmid_flag

Message ID 20240726231512.92867-5-justintee8345@gmail.com
State New
Headers show
Series Update lpfc to revision 14.4.0.4 | expand

Commit Message

Justin Tee July 26, 2024, 11:15 p.m. UTC
The vport->vmid_flag is unintentionally cleared twice after an issue_lip
via the lpfc_reinit_vmid routine.

The first call to lpfc_reinit_vmid is in lpfc_cmpl_els_flogi.  Then
lpfc_cmpl_els_flogi_fabric calls lpfc_register_new_vport, which calls
lpfc_cmpl_reg_new_vport when the mbox command completes and calls
lpfc_reinit_vmid a second time.

Fix by moving the vmid_flag clear outside of the lpfc_reinit_vmid routine
so that vmid_flag is only cleared once upon FLOGI completion.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
---
 drivers/scsi/lpfc/lpfc_els.c  | 4 +++-
 drivers/scsi/lpfc/lpfc_vmid.c | 1 -
 2 files changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 50c0c0c91fdc..6d49e23f6a62 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -1099,8 +1099,10 @@  lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
 			 sp->cmn.priority_tagging, kref_read(&ndlp->kref));
 
 	/* reinitialize the VMID datastructure before returning */
-	if (lpfc_is_vmid_enabled(phba))
+	if (lpfc_is_vmid_enabled(phba)) {
 		lpfc_reinit_vmid(vport);
+		vport->vmid_flag = 0;
+	}
 	if (sp->cmn.priority_tagging)
 		vport->phba->pport->vmid_flag |= (LPFC_VMID_ISSUE_QFPA |
 						  LPFC_VMID_TYPE_PRIO);
diff --git a/drivers/scsi/lpfc/lpfc_vmid.c b/drivers/scsi/lpfc/lpfc_vmid.c
index 773e02ae20c3..cf8ba840d0ea 100644
--- a/drivers/scsi/lpfc/lpfc_vmid.c
+++ b/drivers/scsi/lpfc/lpfc_vmid.c
@@ -321,6 +321,5 @@  lpfc_reinit_vmid(struct lpfc_vport *vport)
 	if (!hash_empty(vport->hash_table))
 		hash_for_each_safe(vport->hash_table, bucket, tmp, cur, hnode)
 			hash_del(&cur->hnode);
-	vport->vmid_flag = 0;
 	write_unlock(&vport->vmid_lock);
 }