Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp939058pxb; Wed, 6 Apr 2022 04:52:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTuflWC1K8v80M33C1dBc0/mM9AuPt0iIQxuecfQN7+SF8Ul2s/SEfdQNk+pS73OA4OEeM X-Received: by 2002:a17:903:1c2:b0:154:5edf:56d3 with SMTP id e2-20020a17090301c200b001545edf56d3mr8444328plh.10.1649245966180; Wed, 06 Apr 2022 04:52:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649245966; cv=none; d=google.com; s=arc-20160816; b=NoVoi521I0j1Pm8uZSSk/xeA/6zTEQJlsj7J18kmfd1u4SUrtZa8kDxAoa2M3uQc5P 7bkEWNsTDgUw2JdXrcF4SwbW+DEPy2twO1pOc7D9yLYoJ3LtolADyigIHji+WV0u1EDE AwyxnN8wPEst+qDKV7lXY/1hgCrQ5QOUPRBnS/rKM8pcy0lhMkAyoOX2YMBn3yE/Ceeb aJCg+wd/WGYwq2q9OoO/zj2p9CByDSkbyxydjnzmBW8heWuV2hilCh9p9WzqmW96dlwr iVPMZ68iVVpb6bZ95erkG0ekZXdxv/zPQ/26Bwvpv7nPqHi39UMddFZUJZyu+tGuL6+3 q/3Q== 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=ksbDwwXNKUp5hRXmHB2PdbfSOubG3emoYoGIs/25uuU=; b=uf5QdU8bcfW6xrgqJNWtIjgZWxU07fv8trdSrtJUPhhzNYiV8k0IZT4yKR2DIHgUFN REwcLBec3H8ifmIjPOj3KyIzNnSuiNEMIyVUOlZUGsk8PnO+ePiJxGCqSVDH8fhpT+Pr CFOnjGLBTKySkbbOBUiCRAeDVB9MKIQeRvhpMp1uCh/MghU/22oXkpANGpUe+9HeVjti qxbXjbIfso/0qiHWnj7Uv8siV+IATUooRqTlNG70z8c5t0C/N0tnXBUZBYjM/ADb2kpF dSP02KmtYwi2m1hqG/yYc50Ib9m2TPn8B3nq4C3jEvsllR6A5GCl/cqStIasa+e8KehJ wAhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hoOgbezB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id f11-20020a170902ce8b00b00153b2d1653dsi15826860plg.325.2022.04.06.04.52.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 04:52:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hoOgbezB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2D62563E010; Wed, 6 Apr 2022 03:13:30 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1449108AbiDEUKQ (ORCPT + 99 others); Tue, 5 Apr 2022 16:10:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353453AbiDEKGN (ORCPT ); Tue, 5 Apr 2022 06:06:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8194BF979; Tue, 5 Apr 2022 02:55:06 -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 ams.source.kernel.org (Postfix) with ESMTPS id 22FD4B818F3; Tue, 5 Apr 2022 09:55:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75321C385A3; Tue, 5 Apr 2022 09:55:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649152503; bh=JvjyQbqzGBHoo/fnIR59SnE5qGnqo560ZSO1/q6vJIc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hoOgbezBodw+wT0ewOVqlBWrpkCYnfhg+S6sW6w6NxG7QznKmUxCm/F5R9EWjddch 5YETxjSqIOOPj+GEE3PzZp2C/vtH7MktPmR2zXDukwAUCZ3ItvjEEGiorEdJ8+Cs7f rVPbdCjFRp5bLjdNs5egQ95rqQo/db6jT/9Uz2dY= 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.15 801/913] scsi: qla2xxx: Fix disk failure to rediscover Date: Tue, 5 Apr 2022 09:31:03 +0200 Message-Id: <20220405070403.842354690@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 @@ -5740,6 +5740,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 | @@ -5847,6 +5849,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); @@ -5861,8 +5864,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 @@ -35,6 +35,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));