Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1942183imm; Thu, 24 May 2018 03:19:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpeTJm3NKrKTmMbXmNbRz8CVSgtMLCf1s5+mdCZnhtOyEwV+8eIni3Jd6HZ+69e04EzqJ+0 X-Received: by 2002:a17:902:bf0a:: with SMTP id bi10-v6mr6590254plb.235.1527157171724; Thu, 24 May 2018 03:19:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527157171; cv=none; d=google.com; s=arc-20160816; b=BoPZIDQZvQ5b6sGaC3B1wTB8oDDJHgYghdKlKzTj9Y9QXXbMQmKlJN7ISmXfki3BRB JcY6ehLXTT1hCuKcOAlaYQDUOnwmzwFA4KkaRm2cvv6EM+Gn0HPaX5cijOuc0VQ22gfy 2wlgfRzzi8jlx82mQawbBCh8Ppu2aX0k8v+280UMo5nGGU6HJdW+q9wOPd02cDS8g7nq ZhZm7jPuSxfQ18XvOzbAIc3SwhEML1U25+CZKklqBje4bVQDtbJ94UCnqUKpOWFSfAsC dYuN3z+GSgjZ/JIMGkxBawKgmkKz/+WS5/nOo/bVIMPhtITvqY/1Lzdf+vky0V9ua6xZ nhRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=+Uu1ssu5Bqutghs+hkq30Dfnic1qzIt86uiigDPSQo4=; b=CT8/ADEoEV0MRFdmdrKFt6OI6uVPp4qAJAmnX82stQsuDGeAyngU2NzNylNI/uVG4q kU4Ky4z7PndV6kw9i9bRfDaGth/tbGxaxr24YLVwpKBHs4uCJtJgssVNGo4g2nxnzOk5 7VUDpN5rYGhPzoRBdYVzsMBwlOK1lw+miXmEyS4ZKEU4W2Jf7A2ngieS08lGADIf20nb CO56vtzeeUg35No3rk9My3thXi2huy1H2qQFfcOP3G/q0nLXFjXrsVPHVgBh/wDEJ4I8 Q2bpWpBtR2OiPnyPMVKfQpAxD91oBzvLroRqAPMsyE5KXgJRSasBlTDpS6n+O2CyJ9L6 xCzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Gsthw2Ik; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n7-v6si139998pgu.362.2018.05.24.03.19.17; Thu, 24 May 2018 03:19:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Gsthw2Ik; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031354AbeEXKD6 (ORCPT + 99 others); Thu, 24 May 2018 06:03:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:53260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030922AbeEXKDy (ORCPT ); Thu, 24 May 2018 06:03:54 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 65DE120891; Thu, 24 May 2018 10:03:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527156233; bh=2ODoPvchQOzbAzRMlmYH008RKk4YrCasripfTrZjL6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gsthw2Ikd6Vne2Woz+5QqBW0JZRKDlLO1pRJmZQmrp6TF4fKheyZyjqSmA/mh7t0V STnrLvmEyhnhMCXn1KnH1vHuXgJCkrKkUnc/l/pyAiKCYcSbNHOGTFPdeX33uk1L5z imjXYezOW41UtrWoPBQL+aq1LUBOTryMY0D9zYXQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dick Kennedy , James Smart , Hannes Reinecke , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.16 113/161] scsi: lpfc: Fix nonrecovery of NVME controller after cable swap. Date: Thu, 24 May 2018 11:38:58 +0200 Message-Id: <20180524093031.879689592@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093018.331893860@linuxfoundation.org> References: <20180524093018.331893860@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: James Smart [ Upstream commit 815a9c437617e221842d12b3366ff6911b3df628 ] In a test that is doing large numbers of cable swaps on the target, the nvme controllers wouldn't reconnect. During the cable swaps, the targets n_port_id would change. This information was passed to the nvme-fc transport, in the new remoteport registration. However, the nvme-fc transport didn't update the n_port_id value in the remoteport struct when it reused an existing structure. Later, when a new association was attempted on the remoteport, the driver's NVME LS routine would use the stale n_port_id from the remoteport struct to address the LS. As the device is no longer at that address, the LS would go into never never land. Separately, the nvme-fc transport will be corrected to update the n_port_id value on a re-registration. However, for now, there's no reason to use the transports values. The private pointer points to the drivers node structure and the node structure is up to date. Therefore, revise the LS routine to use the drivers data structures for the LS. Augmented the debug message for better debugging in the future. Also removed a duplicate if check that seems to have slipped in. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Hannes Reinecke Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/lpfc/lpfc_nvme.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -241,10 +241,11 @@ lpfc_nvme_cmpl_gen_req(struct lpfc_hba * ndlp = (struct lpfc_nodelist *)cmdwqe->context1; lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC, "6047 nvme cmpl Enter " - "Data %p DID %x Xri: %x status %x cmd:%p lsreg:%p " - "bmp:%p ndlp:%p\n", + "Data %p DID %x Xri: %x status %x reason x%x cmd:%p " + "lsreg:%p bmp:%p ndlp:%p\n", pnvme_lsreq, ndlp ? ndlp->nlp_DID : 0, cmdwqe->sli4_xritag, status, + (wcqe->parameter & 0xffff), cmdwqe, pnvme_lsreq, cmdwqe->context3, ndlp); lpfc_nvmeio_data(phba, "NVME LS CMPL: xri x%x stat x%x parm x%x\n", @@ -419,6 +420,7 @@ lpfc_nvme_ls_req(struct nvme_fc_local_po { int ret = 0; struct lpfc_nvme_lport *lport; + struct lpfc_nvme_rport *rport; struct lpfc_vport *vport; struct lpfc_nodelist *ndlp; struct ulp_bde64 *bpl; @@ -437,19 +439,18 @@ lpfc_nvme_ls_req(struct nvme_fc_local_po */ lport = (struct lpfc_nvme_lport *)pnvme_lport->private; + rport = (struct lpfc_nvme_rport *)pnvme_rport->private; vport = lport->vport; if (vport->load_flag & FC_UNLOADING) return -ENODEV; - if (vport->load_flag & FC_UNLOADING) - return -ENODEV; - - ndlp = lpfc_findnode_did(vport, pnvme_rport->port_id); + /* Need the ndlp. It is stored in the driver's rport. */ + ndlp = rport->ndlp; if (!ndlp || !NLP_CHK_NODE_ACT(ndlp)) { lpfc_printf_vlog(vport, KERN_ERR, LOG_NODE | LOG_NVME_IOERR, - "6051 DID x%06x not an active rport.\n", - pnvme_rport->port_id); + "6051 Remoteport %p, rport has invalid ndlp. " + "Failing LS Req\n", pnvme_rport); return -ENODEV; } @@ -500,8 +501,9 @@ lpfc_nvme_ls_req(struct nvme_fc_local_po /* Expand print to include key fields. */ lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC, - "6149 ENTER. lport %p, rport %p lsreq%p rqstlen:%d " - "rsplen:%d %pad %pad\n", + "6149 Issue LS Req to DID 0x%06x lport %p, rport %p " + "lsreq%p rqstlen:%d rsplen:%d %pad %pad\n", + ndlp->nlp_DID, pnvme_lport, pnvme_rport, pnvme_lsreq, pnvme_lsreq->rqstlen, pnvme_lsreq->rsplen, &pnvme_lsreq->rqstdma, @@ -517,7 +519,7 @@ lpfc_nvme_ls_req(struct nvme_fc_local_po ndlp, 2, 30, 0); if (ret != WQE_SUCCESS) { atomic_inc(&lport->xmt_ls_err); - lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC, + lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME_DISC, "6052 EXIT. issue ls wqe failed lport %p, " "rport %p lsreq%p Status %x DID %x\n", pnvme_lport, pnvme_rport, pnvme_lsreq,