All of lore.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 05/12] lpfc: Remove redundant clean up code in disable_vport
Date: Mon,  9 Jan 2023 15:33:10 -0800	[thread overview]
Message-ID: <20230109233317.54737-6-justintee8345@gmail.com> (raw)
In-Reply-To: <20230109233317.54737-1-justintee8345@gmail.com>

The disable_vport path calls the discovery state machine on all ndlps, puts
them into NPR state, and then calls lpfc_cleanup_rpis with the remove flag
set.  This unintentionally decrements an ndlp's kref twice and can result
in premature release of an ndlp because lpfc_dev_loss_tmo_handler triggers
clean up of the ndlp again later.

Remove redundant code in disable_vport that sets all the ndlps to NPR, and
change the call to cleanup_rpis to not remove the ndlps.
lpfc_dev_loss_tmo_handler will handle final removal of the ndlps.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
---
 drivers/scsi/lpfc/lpfc_vport.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c
index 4d171f5c213f..5aeda245369b 100644
--- a/drivers/scsi/lpfc/lpfc_vport.c
+++ b/drivers/scsi/lpfc/lpfc_vport.c
@@ -534,7 +534,7 @@ disable_vport(struct fc_vport *fc_vport)
 {
 	struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data;
 	struct lpfc_hba   *phba = vport->phba;
-	struct lpfc_nodelist *ndlp = NULL, *next_ndlp = NULL;
+	struct lpfc_nodelist *ndlp = NULL;
 	struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
 
 	/* Can't disable during an outstanding delete. */
@@ -546,17 +546,7 @@ disable_vport(struct fc_vport *fc_vport)
 		(void)lpfc_send_npiv_logo(vport, ndlp);
 
 	lpfc_sli_host_down(vport);
-
-	/* Mark all nodes for discovery so we can remove them by
-	 * calling lpfc_cleanup_rpis(vport, 1)
-	 */
-	list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) {
-		if (ndlp->nlp_state == NLP_STE_UNUSED_NODE)
-			continue;
-		lpfc_disc_state_machine(vport, ndlp, NULL,
-					NLP_EVT_DEVICE_RECOVERY);
-	}
-	lpfc_cleanup_rpis(vport, 1);
+	lpfc_cleanup_rpis(vport, 0);
 
 	lpfc_stop_vport_timers(vport);
 	lpfc_unreg_all_rpis(vport);
-- 
2.38.0


  parent reply	other threads:[~2023-01-09 23:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-09 23:33 [PATCH 00/12] lpfc: Update lpfc to revision 14.2.0.10 Justin Tee
2023-01-09 23:33 ` [PATCH 01/12] lpfc: Fix space indentation in lpfc_xcvr_data Justin Tee
2023-01-09 23:33 ` [PATCH 02/12] lpfc: Replace outdated strncpy with strscpy Justin Tee
2023-01-09 23:33 ` [PATCH 03/12] lpfc: Resolve miscellaneous variable set but not used compiler warnings Justin Tee
2023-01-09 23:33 ` [PATCH 04/12] lpfc: Set max dma segment size to hba supported SGE length Justin Tee
2023-01-09 23:33 ` Justin Tee [this message]
2023-01-09 23:33 ` [PATCH 06/12] lpfc: Remove duplicate ndlp kref decrement in lpfc_cleanup_rpis Justin Tee
2023-01-09 23:33 ` [PATCH 07/12] lpfc: Exit PRLI completion handling early if ndlp not in PRLI_ISSUE state Justin Tee
2023-01-09 23:33 ` [PATCH 08/12] lpfc: Fix use-after-free KFENCE violation during sysfs firmware write Justin Tee
2023-01-09 23:33 ` [PATCH 09/12] lpfc: Reinitialize internal VMID data structures after FLOGI completion Justin Tee
2023-01-09 23:33 ` [PATCH 10/12] lpfc: Introduce new attention types for lpfc_sli4_async_fc_evt hdlr Justin Tee
2023-01-09 23:33 ` [PATCH 11/12] lpfc: Update lpfc version to 14.2.0.10 Justin Tee
2023-01-09 23:33 ` [PATCH 12/12] Copyright updates for 14.2.0.10 patches Justin Tee
2023-01-12  5:05 ` [PATCH 00/12] lpfc: Update lpfc to revision 14.2.0.10 Martin K. Petersen
2023-01-14  3:19 ` 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=20230109233317.54737-6-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.