Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp666045pxb; Tue, 5 Apr 2022 17:57:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTn/5EcKE9DXTOOvwcj6+/eIamS7PLs0UWUFuue11rFoczKNOfgYx5kYW3BdKtOUo34Hkj X-Received: by 2002:a05:6402:4402:b0:41c:d169:d8ea with SMTP id y2-20020a056402440200b0041cd169d8eamr6317311eda.303.1649206661651; Tue, 05 Apr 2022 17:57:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649206661; cv=none; d=google.com; s=arc-20160816; b=zELdB+QdSQetrpRfA9lbXfprQFGoyMzlfoJBBkVh5TmAMrdi05cdf9gG7ExVm3jqSO +rphMvt8uYsQkVu3BVd5dcBn7xTVSdchRB/GK4VtrwaQoK1jBgkyLEaoxRGZtBpbIXXJ DvNDzTnxmva0Ld3YYd1KpmXS8wRD2mHGadToaJF5f6JfZUNPy4bzWEgBOyIY79xXaSJK pgmeIgox6CTVQNVKG4CaUur28OQOC3s6kqaV8mBkrW6T6YODczBxfqFk5pWYjGRGvQaY zSKSo50pPJoFP2E1j0KkM2h5qz5vANcgjKG+xeOMVFLjVB6PDg1arp+cUju+c+0KY96H /8Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FFqD0pO+9qx03FGtZTnvqA/66rrmVWjJHv+4c2X45A0=; b=nSNZm3L7rCF4APdQLg4faX8kNZyrBlNsRZ6JRdr2f/7yvVo3J8isju1HrAi8KSYxZq Q2W3FCzX5lfTVce19jv4h6nLKDBaJpqZ+3vYYoYemfsRa/H2RKLjEMj0PxefEfiR/VPL xg0Px/kmmGfj1N7qfKSN+V0NJ1l9NGx63fMIad7qoqLlPufiiajhoEcb4Idy9gn5bRYi gREKIW9cr0JtXd5vS6c5DOSFrzX05DoCAjXrFRB3H5WoVdfz5saG155eWJjZCVr7lTZ3 yQ7U96kgsmBSRpVE/lySzdhcdRGmKGzQlOGkEpiggOQH3ecVqR2QcvqCW9DZEJ4pmbVC GVuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NBrapJft; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g11-20020a056402090b00b00418c2b5bde6si11284208edz.200.2022.04.05.17.57.14; Tue, 05 Apr 2022 17:57:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NBrapJft; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384048AbiDENb7 (ORCPT + 99 others); Tue, 5 Apr 2022 09:31:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345721AbiDEJW6 (ORCPT ); Tue, 5 Apr 2022 05:22:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3769D71A26; Tue, 5 Apr 2022 02:11:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BA9B8615F1; Tue, 5 Apr 2022 09:11:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6160C385A2; Tue, 5 Apr 2022 09:11:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649149918; bh=otzYYpWm1DE4l/EFXF5rmcG0L81c9Jdh+PbhGx+ObK8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NBrapJftrBSkE4LyjbNQ0ZLrzoa4RZa1cleiN9bKlKS8oK1NWKFHOTEBdC/YbxQu4 +l6X6m1blA0KhEG8BCkzpGlMA4WAWyfWgBTjx5+BbtiSHqpew/3Lk916TDpl7x6D+R 4De1Tff5zmTgqlXh4FQb3Yx0C5SoTkzn2sBDYI7A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Quinn Tran , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.16 0889/1017] scsi: qla2xxx: Fix disk failure to rediscover Date: Tue, 5 Apr 2022 09:30:02 +0200 Message-Id: <20220405070420.618127102@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Quinn Tran commit 6a45c8e137d4e2c72eecf1ac7cf64f2fdfcead99 upstream. User experienced some of the LUN failed to get rediscovered after long cable pull test. The issue is triggered by a race condition between driver setting session online state vs starting the LUN scan process at the same time. Current code set the online state after notifying the session is available. In this case, trigger to start the LUN scan process happened before driver could set the session in online state. LUN scan ends up with failure due to the session online check was failing. Set the online state before reporting of the availability of the session. Link: https://lore.kernel.org/r/20220310092604.22950-3-njavali@marvell.com Fixes: aecf043443d3 ("scsi: qla2xxx: Fix Remote port registration") Cc: stable@vger.kernel.org Reviewed-by: Himanshu Madhani Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/qla2xxx/qla_init.c | 5 +++-- drivers/scsi/qla2xxx/qla_nvme.c | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -5758,6 +5758,8 @@ qla2x00_reg_remote_port(scsi_qla_host_t if (atomic_read(&fcport->state) == FCS_ONLINE) return; + qla2x00_set_fcport_state(fcport, FCS_ONLINE); + rport_ids.node_name = wwn_to_u64(fcport->node_name); rport_ids.port_name = wwn_to_u64(fcport->port_name); rport_ids.port_id = fcport->d_id.b.domain << 16 | @@ -5865,6 +5867,7 @@ qla2x00_update_fcport(scsi_qla_host_t *v qla2x00_reg_remote_port(vha, fcport); break; case MODE_TARGET: + qla2x00_set_fcport_state(fcport, FCS_ONLINE); if (!vha->vha_tgt.qla_tgt->tgt_stop && !vha->vha_tgt.qla_tgt->tgt_stopped) qlt_fc_port_added(vha, fcport); @@ -5879,8 +5882,6 @@ qla2x00_update_fcport(scsi_qla_host_t *v break; } - qla2x00_set_fcport_state(fcport, FCS_ONLINE); - if (IS_IIDMA_CAPABLE(vha->hw) && vha->hw->flags.gpsc_supported) { if (fcport->id_changed) { fcport->id_changed = 0; --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -37,6 +37,11 @@ int qla_nvme_register_remote(struct scsi (fcport->nvme_flag & NVME_FLAG_REGISTERED)) return 0; + if (atomic_read(&fcport->state) == FCS_ONLINE) + return 0; + + qla2x00_set_fcport_state(fcport, FCS_ONLINE); + fcport->nvme_flag &= ~NVME_FLAG_RESETTING; memset(&req, 0, sizeof(struct nvme_fc_port_info));