Blob Blame History Raw
From: James Smart <jsmart2021@gmail.com>
Date: Tue, 12 Apr 2022 15:19:53 -0700
Subject: scsi: lpfc: Transition to NPR state upon LOGO cmpl if link down or
 aborted
Patch-mainline: v5.19-rc1
Git-commit: 76395c88d0afb82c9bec87e99e282c4ff11ea5f4
References: bsc#1200045

In P2P topology, a target controller reboot sometimes results in not
reestablishing a login because the ndlp is stuck in LOGO state.

Fix by transitioning to NPR state if we get link down before LOGO
completes.

Link: https://lore.kernel.org/r/20220412222008.126521-12-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Daniel Wagner <dwagner@suse.de>
---
 drivers/scsi/lpfc/lpfc_els.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -3007,7 +3007,10 @@ lpfc_cmpl_els_logo(struct lpfc_hba *phba
 				 ndlp->nlp_DID, ulp_status,
 				 ulp_word4);
 
+		/* Call NLP_EVT_DEVICE_RM if link is down or LOGO is aborted */
 		if (lpfc_error_lost_link(ulp_status, ulp_word4)) {
+			lpfc_disc_state_machine(vport, ndlp, cmdiocb,
+						NLP_EVT_DEVICE_RM);
 			skip_recovery = 1;
 			goto out;
 		}