public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Justin Tee <justintee8345@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: jsmart2021@gmail.com, justin.tee@broadcom.com,
	Justin Tee <justintee8345@gmail.com>
Subject: [PATCH 4/8] lpfc: Fix unintentional double clearing of vmid_flag
Date: Fri, 26 Jul 2024 16:15:08 -0700	[thread overview]
Message-ID: <20240726231512.92867-5-justintee8345@gmail.com> (raw)
In-Reply-To: <20240726231512.92867-1-justintee8345@gmail.com>

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 --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);
 }
-- 
2.38.0


  parent reply	other threads:[~2024-07-26 23:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-26 23:15 [PATCH 0/8] Update lpfc to revision 14.4.0.4 Justin Tee
2024-07-26 23:15 ` [PATCH 1/8] lpfc: Change diagnostic log flag during receipt of unknown ELS cmds Justin Tee
2024-07-26 23:15 ` [PATCH 2/8] lpfc: Remove redundant vport assignment when building an abort request Justin Tee
2024-07-26 23:15 ` [PATCH 3/8] lpfc: Validate hdwq pointers before dereferencing in reset/errata paths Justin Tee
2024-07-26 23:15 ` Justin Tee [this message]
2024-07-26 23:15 ` [PATCH 5/8] lpfc: Fix unsolicited FLOGI kref imbalance when in direct attached topology Justin Tee
2024-07-26 23:15 ` [PATCH 6/8] lpfc: Update PRLO handling " Justin Tee
2024-07-26 23:15 ` [PATCH 7/8] lpfc: Update lpfc version to 14.4.0.4 Justin Tee
2024-07-26 23:15 ` [PATCH 8/8] lpfc: Copyright updates for 14.4.0.4 patches Justin Tee
2024-08-03  1:50 ` [PATCH 0/8] Update lpfc to revision 14.4.0.4 Martin K. Petersen
2024-08-05 21:17 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240726231512.92867-5-justintee8345@gmail.com \
    --to=justintee8345@gmail.com \
    --cc=jsmart2021@gmail.com \
    --cc=justin.tee@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox