From patchwork Fri Sep 22 06:17:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 9965215 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 16F4A602D8 for ; Fri, 22 Sep 2017 06:18:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08EDB29707 for ; Fri, 22 Sep 2017 06:18:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F22492970B; Fri, 22 Sep 2017 06:18:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90FB029707 for ; Fri, 22 Sep 2017 06:18:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751860AbdIVGSB (ORCPT ); Fri, 22 Sep 2017 02:18:01 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:36701 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751845AbdIVGR6 (ORCPT ); Fri, 22 Sep 2017 02:17:58 -0400 Received: by mail-pg0-f66.google.com with SMTP id d8so120474pgt.3 for ; Thu, 21 Sep 2017 23:17:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6hKuJYXFlu5LaUk/XiVi9d2imiyeqVWDIyirdfKpK/E=; b=X3EkS5eXMw7947Pgugnjzc2cPkzdGGWf1Ltvke+z3O7qRu52dU29tHj8hg7Qhw0hX+ YWeFEBUyTGu4/SpCRyyZzgY06IO6FKeeJHJH0sdkxIvoZ8XcrpeWJGVMO9ujd3CWDcTj vNuv5gzyZ/dsR3zBGcHVN+STMlCi9uOde4HZPB+BsPuS3D3q/jLPRrLHA1mVfga9yVHs GQ9njuhw6onbGJQ7lokoKyHj7+BS4Jqpgozl5xbw7/hKW0XgsrtlN0jFk1H8nKbXt5CQ xDmmPDDqVSuIikK2drjvWTKy3V5Rj4M3CZ2uYNCA1cAYnLfKqFC4GFPkUpJCgNAzNRRz kq1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6hKuJYXFlu5LaUk/XiVi9d2imiyeqVWDIyirdfKpK/E=; b=hceRIW9bcv5CZNS3d21c0hn/yraWL2qZTi/XPdbvqBzdXCFDLF6LDS1OX8GlXTb5sV Ubr3TYWOTGZM2qTpMhE4pzoIaqOLo25wR+IdMr3efrhazQnfLihKvhxDmxjW309QZgvT xjzrV+zKoKpnGt4gWAyT5qj54PCSb6n/SK1Fqn6jKzBFrlqDB9g++MvqRejjJR4txw/m nRfIoDtkxzD1HoA7oH3mJti952yQVJOXj4l33soVG23U32zPiXyWp7pV/aGPS/rOfgKS 1SyM0O3WPjM4YWdrMxMiAGlQG5WF6D3dyCyof9jK5yRTeMtmtR0/jKI9mlIXNWSsao1v 3SIg== X-Gm-Message-State: AHPjjUjzkXOOx5YWBOVPENck9VMeP+RzQ+exZ70Lxu8uNANmviEjRnHq MDWqZMuS8IoRuJpIqF28/CtDWg== X-Google-Smtp-Source: AOwi7QCNVNbblS2l7XVJ/6mlokKYkvYlwp3Hw4S6NBKFcBrE5QaLdtWxFtwxeTYDQRssVGxts/uT+g== X-Received: by 10.99.116.21 with SMTP id p21mr8173775pgc.93.1506061078185; Thu, 21 Sep 2017 23:17:58 -0700 (PDT) Received: from os42.localdomain (ip68-4-115-207.oc.oc.cox.net. [68.4.115.207]) by smtp.gmail.com with ESMTPSA id e87sm5911355pfl.46.2017.09.21.23.17.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Sep 2017 23:17:57 -0700 (PDT) From: James Smart To: linux-scsi@vger.kernel.org Cc: Dick Kennedy , James Smart Subject: [PATCH 03/19] lpfc: Fix lpfc nvme host rejecting IO with Not Ready message Date: Thu, 21 Sep 2017 23:17:25 -0700 Message-Id: <20170922061741.12347-4-jsmart2021@gmail.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170922061741.12347-1-jsmart2021@gmail.com> References: <20170922061741.12347-1-jsmart2021@gmail.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dick Kennedy In a link bounce scenario, a condition can occur where the discovery engine swaps an ndlp structure (address changbe for an nport). While the swap was successfully executed by the discovery engine, the driver did not properly detect a change in the ndlp bound to the nvme rport. This error resulted in the nvme host transport issuing an IO to the correct nvme rport, but the lpfc driver addressed a ndlp with an NLP_UNUSED status and failed the io. This resulting it it looking like there were missing namespaces and applications failed due to io errors. To fix, in lpfc_nvme_register_rport, rework the "rebind" case to break the nvme rport<->ndlp association when the ndlp already has an nrport. Then rebind the rport to the correct ndlp data and backpointers. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Johannes Thumshirn --- drivers/scsi/lpfc/lpfc_nvme.c | 46 ++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index 79ba3ce063a4..2ad23b356bfe 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -2296,6 +2296,7 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) struct lpfc_nvme_rport *rport; struct nvme_fc_remote_port *remote_port; struct nvme_fc_port_info rpinfo; + struct lpfc_nodelist *prev_ndlp; lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NVME_DISC, "6006 Register NVME PORT. DID x%06x nlptype x%x\n", @@ -2332,7 +2333,7 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) * new rport. */ rport = remote_port->private; - if (ndlp->nrport == rport) { + if (ndlp->nrport) { lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NVME_DISC, "6014 Rebinding lport to " @@ -2343,24 +2344,33 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) remote_port->port_role, ndlp->nlp_type, ndlp->nlp_DID); - } else { - /* New rport. */ - rport->remoteport = remote_port; - rport->lport = lport; - rport->ndlp = lpfc_nlp_get(ndlp); - if (!rport->ndlp) - return -1; - ndlp->nrport = rport; - lpfc_printf_vlog(vport, KERN_INFO, - LOG_NVME_DISC | LOG_NODE, - "6022 Binding new rport to " - "lport %p Rport WWNN 0x%llx, " - "Rport WWPN 0x%llx DID " - "x%06x Role x%x\n", - lport, - rpinfo.node_name, rpinfo.port_name, - rpinfo.port_id, rpinfo.port_role); + prev_ndlp = rport->ndlp; + + /* Sever the ndlp<->rport connection before dropping + * the ndlp ref from register. + */ + ndlp->nrport = NULL; + rport->ndlp = NULL; + if (prev_ndlp) + lpfc_nlp_put(ndlp); } + + /* Clean bind the rport to the ndlp. */ + rport->remoteport = remote_port; + rport->lport = lport; + rport->ndlp = lpfc_nlp_get(ndlp); + if (!rport->ndlp) + return -1; + ndlp->nrport = rport; + lpfc_printf_vlog(vport, KERN_INFO, + LOG_NVME_DISC | LOG_NODE, + "6022 Binding new rport to " + "lport %p Rport WWNN 0x%llx, " + "Rport WWPN 0x%llx DID " + "x%06x Role x%x\n", + lport, + rpinfo.node_name, rpinfo.port_name, + rpinfo.port_id, rpinfo.port_role); } else { lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME_DISC | LOG_NODE,