From patchwork Fri May 22 14:42:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 6465161 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 05BBAC0020 for ; Fri, 22 May 2015 14:42:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2999C2034E for ; Fri, 22 May 2015 14:42:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 34DA720160 for ; Fri, 22 May 2015 14:42:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757002AbbEVOmr (ORCPT ); Fri, 22 May 2015 10:42:47 -0400 Received: from mail-qg0-f46.google.com ([209.85.192.46]:35747 "EHLO mail-qg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756757AbbEVOmp (ORCPT ); Fri, 22 May 2015 10:42:45 -0400 Received: by qgew3 with SMTP id w3so9072662qge.2 for ; Fri, 22 May 2015 07:42:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:user-agent :mime-version:content-type:content-transfer-encoding; bh=ExogtW6e26Syx8dp8Tdi7AujeTAEM8Oaek/5xcVuMVM=; b=POCHji8AB2Hjc00WMh6I55nzerqfGz81s9KUZ7etg39kmCbJgqhdpMcQ1Riu9jbWnB X86bydlT74rJknWnQhE5urYFNWa/8cVzIvaJVBlzkwD81l1MVAdzmzYw6NbBC87UQq2i ZH8E5aT+Qse5QiINrbAgFnZy/QfKSd68QNoww2RJOd2tG45wbBCc7yJQYIdtHbh9ihxe 1uJPh2peIs1f4p4ja3LLGPBEXdLA8edAK2d8uL5TYlQkTh7ofuxyC64Aq8vpnYITFvJN 79H1uPrE5mMgehoQdWNOShlzZUEoggUFLDczeQT/VuMcdoyuzWxuRkIeAl9lk0axvkER Yq/A== X-Gm-Message-State: ALoCoQlBG/sHX8rE0W++a/YAHgoZ9GgJvMgGS1fiucvxD/nKMXENfa7HF+TX49nElsZ/r+6kF1pS X-Received: by 10.55.19.82 with SMTP id d79mr4043172qkh.21.1432305764408; Fri, 22 May 2015 07:42:44 -0700 (PDT) Received: from myfc17 (c-75-67-235-135.hsd1.nh.comcast.net. [75.67.235.135]) by mx.google.com with ESMTPSA id f192sm1394322qhc.37.2015.05.22.07.42.43 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 22 May 2015 07:42:44 -0700 (PDT) Date: Fri, 22 May 2015 10:42:37 -0400 From: james.smart@avagotech.com (James Smart) To: linux-scsi@vger.kernel.org Subject: [PATCH 3/9] lpfc: Devices are not discovered during takeaway/giveback testing Message-ID: <555f405d.19aP4Ju4SItrRE4D%james.smart@avagotech.com> User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Devices are not discovered during takeaway/giveback testing When a remote nport changes it's DID, a new ndlp is used. However, we left the old ndlp state unchanged and still in a discovery state. The may stall discovery resulting in some devices not being discovered. Correct by swapping the state of the 2 ndlp's when a DID swap is detected. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Hannes Reinecke --- drivers/scsi/lpfc/lpfc_els.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 30021f3..21c4a3d 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -1509,12 +1509,14 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp, struct lpfc_nodelist *ndlp) { struct lpfc_vport *vport = ndlp->vport; + struct Scsi_Host *shost = lpfc_shost_from_vport(vport); struct lpfc_nodelist *new_ndlp; struct lpfc_rport_data *rdata; struct fc_rport *rport; struct serv_parm *sp; uint8_t name[sizeof(struct lpfc_name)]; uint32_t rc, keepDID = 0, keep_nlp_flag = 0; + uint16_t keep_nlp_state; int put_node; int put_rport; unsigned long *active_rrqs_xri_bitmap = NULL; @@ -1603,11 +1605,14 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp, ndlp->active_rrqs_xri_bitmap, phba->cfg_rrq_xri_bitmap_sz); + spin_lock_irq(shost->host_lock); keep_nlp_flag = new_ndlp->nlp_flag; new_ndlp->nlp_flag = ndlp->nlp_flag; ndlp->nlp_flag = keep_nlp_flag; + spin_unlock_irq(shost->host_lock); - /* Set state will put new_ndlp on to node list if not already done */ + /* Set nlp_states accordingly */ + keep_nlp_state = new_ndlp->nlp_state; lpfc_nlp_set_state(vport, new_ndlp, ndlp->nlp_state); /* Move this back to NPR state */ @@ -1668,20 +1673,13 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp, active_rrqs_xri_bitmap, phba->cfg_rrq_xri_bitmap_sz); - /* Since we are swapping the ndlp passed in with the new one - * and the did has already been swapped, copy over state. - * The new WWNs are already in new_ndlp since thats what - * we looked it up by in the begining of this routine. - */ - new_ndlp->nlp_state = ndlp->nlp_state; - - /* Since we are switching over to the new_ndlp, the old - * ndlp should be put in the NPR state, unless we have - * already started re-discovery on it. + /* Since we are switching over to the new_ndlp, + * reset the old ndlp state */ if ((ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) || (ndlp->nlp_state == NLP_STE_MAPPED_NODE)) - lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); + keep_nlp_state = NLP_STE_NPR_NODE; + lpfc_nlp_set_state(vport, ndlp, keep_nlp_state); /* Fix up the rport accordingly */ rport = ndlp->rport;