Johannes Thumshirn 93392a
From: James Smart <jsmart2021@gmail.com>
Johannes Thumshirn 93392a
Date: Tue, 30 Jan 2018 15:58:47 -0800
Johannes Thumshirn 93392a
Subject: scsi: lpfc: move placement of target destroy on driver detach
Jiri Kosina 835656
Patch-mainline: v4.17-rc1
Johannes Thumshirn 93392a
Git-commit: 281d61902ffbab47901f8616a38a45144627dd9e
Johannes Thumshirn 93392a
References: bsc#1080657
Johannes Thumshirn 93392a
Johannes Thumshirn 93392a
Ensure nvme localports/targetports are torn down before dismantling the
Johannes Thumshirn 93392a
adapter sli interface on driver detachment.  This aids leaving
Johannes Thumshirn 93392a
interfaces live while nvme may be making callbacks to abort it.
Johannes Thumshirn 93392a
Johannes Thumshirn 93392a
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Johannes Thumshirn 93392a
Signed-off-by: James Smart <james.smart@broadcom.com>
Johannes Thumshirn 93392a
Reviewed-by: Hannes Reinecke <hare@suse.com>
Johannes Thumshirn 93392a
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Johannes Thumshirn 93392a
Acked-by: Johannes Thumshirn <jthumshirn@suse.de>
Johannes Thumshirn 93392a
---
Johannes Thumshirn 93392a
 drivers/scsi/lpfc/lpfc_init.c |   14 +++++++-------
Johannes Thumshirn 93392a
 1 file changed, 7 insertions(+), 7 deletions(-)
Johannes Thumshirn 93392a
Johannes Thumshirn 93392a
--- a/drivers/scsi/lpfc/lpfc_init.c
Johannes Thumshirn 93392a
+++ b/drivers/scsi/lpfc/lpfc_init.c
Johannes Thumshirn 93392a
@@ -11510,13 +11510,6 @@ lpfc_pci_remove_one_s4(struct pci_dev *p
Johannes Thumshirn 93392a
 	/* Remove FC host and then SCSI host with the physical port */
Johannes Thumshirn 93392a
 	fc_remove_host(shost);
Johannes Thumshirn 93392a
 	scsi_remove_host(shost);
Johannes Thumshirn 93392a
-	/*
Johannes Thumshirn 93392a
-	 * Bring down the SLI Layer. This step disables all interrupts,
Johannes Thumshirn 93392a
-	 * clears the rings, discards all mailbox commands, and resets
Johannes Thumshirn 93392a
-	 * the HBA FCoE function.
Johannes Thumshirn 93392a
-	 */
Johannes Thumshirn 93392a
-	lpfc_debugfs_terminate(vport);
Johannes Thumshirn 93392a
-	lpfc_sli4_hba_unset(phba);
Johannes Thumshirn 93392a
 
Johannes Thumshirn 93392a
 	/* Perform ndlp cleanup on the physical port.  The nvme and nvmet
Johannes Thumshirn 93392a
 	 * localports are destroyed after to cleanup all transport memory.
Johannes Thumshirn 93392a
@@ -11525,6 +11518,13 @@ lpfc_pci_remove_one_s4(struct pci_dev *p
Johannes Thumshirn 93392a
 	lpfc_nvmet_destroy_targetport(phba);
Johannes Thumshirn 93392a
 	lpfc_nvme_destroy_localport(vport);
Johannes Thumshirn 93392a
 
Johannes Thumshirn 93392a
+	/*
Johannes Thumshirn 93392a
+	 * Bring down the SLI Layer. This step disables all interrupts,
Johannes Thumshirn 93392a
+	 * clears the rings, discards all mailbox commands, and resets
Johannes Thumshirn 93392a
+	 * the HBA FCoE function.
Johannes Thumshirn 93392a
+	 */
Johannes Thumshirn 93392a
+	lpfc_debugfs_terminate(vport);
Johannes Thumshirn 93392a
+	lpfc_sli4_hba_unset(phba);
Johannes Thumshirn 93392a
 
Johannes Thumshirn 93392a
 	lpfc_stop_hba_timers(phba);
Johannes Thumshirn 93392a
 	spin_lock_irq(&phba->hbalock);