From patchwork Wed Aug 2 23:36:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 9877915 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 13A9660360 for ; Wed, 2 Aug 2017 23:37:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 057C82878E for ; Wed, 2 Aug 2017 23:37:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED26A28842; Wed, 2 Aug 2017 23:37:54 +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 767C22878E for ; Wed, 2 Aug 2017 23:37:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751825AbdHBXhy (ORCPT ); Wed, 2 Aug 2017 19:37:54 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:38403 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751737AbdHBXhw (ORCPT ); Wed, 2 Aug 2017 19:37:52 -0400 Received: by mail-qt0-f195.google.com with SMTP id p3so6126055qtg.5 for ; Wed, 02 Aug 2017 16:37:52 -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=oFjxfaeNlnx8uG6Cr7ggZoUQih5aweMivSOfxOzbfmA=; b=Fzt3WrmjCCbq3pLs4CB+odAtOw5tMstJxhtTY9E/rhqlOywk8IaQndnHBgyEtH71Pv lwR37LFtTDMPpMjFEji34n+Amms//elIRlSeuaVkDQy65YB/hybjH/9smRrqCps4WB+Y jLMhd2WYNN37+wjQ7iM31typ3XihO/0ywNUi65SXZBzsNbNzVLDHI8rf6v9fdOFd05W+ Ly2ik3LH/XfwfcFS2cHFz1mAsN+6JUzXBGNwbbS6PUDsE+OD7IrsDkuhM3CxMGq/hPxR XzCfnux48sYU/8jjqlzIQNlm8UBT9yA5TS0n5R6FRTB+O8fsetaLPIPRnd6dH3XYFDxf Yolg== 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=oFjxfaeNlnx8uG6Cr7ggZoUQih5aweMivSOfxOzbfmA=; b=rxFlwc9OlPZSLmJGv6Cxi3JXNlmWQq3uzp5HFiLotq/DAUFMf3HTO4FhrYBuHSBJiz vym+oYLmx1TOJVh/+KhN1q3kRiwbW2qyP2MdgLtqlGVU2/lDPdq6oV1oRTdHAMc9+8LP n199PeBIoKBQsj6K9oBQswfeQNKOU5XKCTwe8OF++30KF5mmIGsTRUS7UD/Ca9z+ya81 dla4b9u0E7LMpjY/TIzpQPaA0qveZ0V6OpK/y3/Tb9xrKLP9eF4m2y9eGuFrBhbwSe9K AFw00Z/WcilZRJq1T6dO5XBwTdiDCjRd1s299vagU1tk64+2bNizhgcB5klHdUlwUwFh +v5A== X-Gm-Message-State: AIVw113lpZOcpRbVLJhKyZnk2uXcA1XcSTi+FW6m1SDW0EoHvujLq/0u OAo6kPeG972+ZBDy X-Received: by 10.200.51.212 with SMTP id d20mr34930399qtb.204.1501717071858; Wed, 02 Aug 2017 16:37:51 -0700 (PDT) Received: from pallmd1.broadcom.com ([192.19.255.250]) by smtp.gmail.com with ESMTPSA id c55sm26260318qta.8.2017.08.02.16.37.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Aug 2017 16:37:50 -0700 (PDT) From: James Smart To: linux-scsi@vger.kernel.org Cc: Dick Kennedy , James Smart Subject: [PATCH 02/21] lpfc: Fix plogi collision that causes illegal state transition Date: Wed, 2 Aug 2017 16:36:29 -0700 Message-Id: <20170802233648.4573-3-jsmart2021@gmail.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170802233648.4573-1-jsmart2021@gmail.com> References: <20170802233648.4573-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 Message "0271 Illegal State Transition: node" seen in logs, all luns are unuseable for that target. A window exists in the rcv_plogi path where if the state is plogi issue but the driver has not issued a plogi, then two reglogins will be sent for the same RPI. The first one to complete will advance the state to prli issue the second one will be detected as an illegal state, and leave the node in an unusable state. Correct the completion routine for the PLOGI ACC that detects the state change when the driver starts discovery on the node again and drop the REGLOGIN mailbox command. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_els.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 6d1d6f691df4..9e9aa8bb7001 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -3930,7 +3930,31 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, if (mbox) { if ((rspiocb->iocb.ulpStatus == 0) && (ndlp->nlp_flag & NLP_ACC_REGLOGIN)) { - lpfc_unreg_rpi(vport, ndlp); + if (!lpfc_unreg_rpi(vport, ndlp)) { + if (ndlp->nlp_state == NLP_STE_PLOGI_ISSUE || + ndlp->nlp_state == + NLP_STE_REG_LOGIN_ISSUE) { + lpfc_printf_vlog(vport, KERN_INFO, + LOG_DISCOVERY, + "0314 PLOGI recov " + "DID x%x " + "Data: x%x x%x x%x\n", + ndlp->nlp_DID, + ndlp->nlp_state, + ndlp->nlp_rpi, + ndlp->nlp_flag); + mp = (struct lpfc_dmabuf *) + mbox->context1; + if (mp) { + lpfc_mbuf_free(phba, mp->virt, + mp->phys); + kfree(mp); + } + mempool_free(mbox, phba->mbox_mem_pool); + goto out; + } + } + /* Increment reference count to ndlp to hold the * reference to ndlp for the callback function. */