Re: [PATCH v3 15/20] lpfc: Fix nvme target failure after 2nd adapter reset

2017-08-28 Thread Johannes Thumshirn

Reviewed-by: Johannes Thumshirn 
-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850


[PATCH v3 15/20] lpfc: Fix nvme target failure after 2nd adapter reset

2017-08-23 Thread James Smart
From: Dick Kennedy 

Fix nvme target failure after 2nd adapter reset

The nonrecovery occurred because the lpfc nvme initiator
function did not reestablish its localport creation with the nvme
host transport in lpfc_oneline.  Because of that, an NVME rport
binding could not take place.

Corrected by recreating the localport in the adapter reset recovery
routine.

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 

---
v3:
  rework indentation per review comment
---
 drivers/scsi/lpfc/lpfc_init.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index c22b88a08c1b..b21ac2bb0dd3 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -3047,7 +3047,7 @@ lpfc_online(struct lpfc_hba *phba)
 {
struct lpfc_vport *vport;
struct lpfc_vport **vports;
-   int i;
+   int i, error = 0;
bool vpis_cleared = false;
 
if (!phba)
@@ -3071,6 +3071,18 @@ lpfc_online(struct lpfc_hba *phba)
if (!phba->sli4_hba.max_cfg_param.vpi_used)
vpis_cleared = true;
spin_unlock_irq(>hbalock);
+
+   /* Reestablish the local initiator port.
+* The offline process destroyed the previous lport.
+*/
+   if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME &&
+   !phba->nvmet_support) {
+   error = lpfc_nvme_create_localport(phba->pport);
+   if (error)
+   lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
+   "6132 NVME restore reg failed "
+   "on nvmei error x%x\n", error);
+   }
} else {
lpfc_sli_queue_init(phba);
if (lpfc_sli_hba_setup(phba)) { /* Initialize SLI2/SLI3 HBA */
-- 
2.13.1