Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp694225pxb; Tue, 5 Apr 2022 19:04:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTGfWXiiWhd9cHEQpd1D4ypr6YHW69sC7097RVD2OVYzDKOANoNnGb9JetJ6WkMd5nZYQs X-Received: by 2002:a63:794c:0:b0:398:2f41:4b0f with SMTP id u73-20020a63794c000000b003982f414b0fmr5120747pgc.448.1649210593281; Tue, 05 Apr 2022 19:03:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649210593; cv=none; d=google.com; s=arc-20160816; b=q2bc8xUNOtfEagOC6tNlSgU3ybAHp1oMwrp4jvfuzW3DDqfiMS315iBE8mEXcjlxK5 6Hnee7bzkbki3qmaYmIirj589NHr/TkVk477sOKbORziliWZWKbQHmiTDiT/JV7w1nwZ iOlLukeawDaz4iL3iGN1OXhHa2Vi2laVQOxuzBD17Zyt7arRu2NBaSwgX8BX5kPlt2Ep gE4YvM+Z4TtGYXWzVBJ9ymvvjpvr3AAukq36RVDDP5SJWfRcH3eKKr+TjM8en1uJyD/4 yfFnVvYmjckB0M2FAxBSH9yAkgDEqcnGBzy5IA5A4b+pVj9ZKZ3hvlFOw0Hv5P2qcpfm 3Nuw== 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=VCBi/BvqxICFcSpnQMNfT4xapSmUG3R2aFFCTWCe1jc=; b=hEwwsdfO/fr55tWhSJEVzA4UYB0EU59YM75kPJxv5k/h+X5b4+3q7BSxaSvb5/cBNB o8HYe+Mx+WSF42O+FolDEAL+2TOLL4m94U9ZFgtOakPBU3X7qMK0wbYxSiafywE77nCc MA6Uc9aanuPAvgUz62+DczD3x2xz8baAkch1BJ6AUQbFnPmKf9dNBOC8NkAwrptPxQLN R3iyp//ohMh9/Oc0bWfhNESyO5JeyAhJoAS+25WPikQYed9j5KL7YWrJB+plsbOFDoNT ytT+bCR0u56aT5OKqST/Ta+cGwMMY0/074XGN6/2c+8hkHb38IbpXaSv+HFOZE9050tz +ktg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=162noxdT; 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 g3-20020a170902868300b0015605e9e571si13507779plo.494.2022.04.05.19.02.54; Tue, 05 Apr 2022 19:03:13 -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=162noxdT; 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 S1384751AbiDENc3 (ORCPT + 99 others); Tue, 5 Apr 2022 09:32:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345761AbiDEJXA (ORCPT ); Tue, 5 Apr 2022 05:23:00 -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 A3B398BE3E; Tue, 5 Apr 2022 02:12:07 -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 F2D73B80DA1; Tue, 5 Apr 2022 09:12:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4965DC385A6; Tue, 5 Apr 2022 09:12:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649149923; bh=xOIsufLeQocMH3kgT/ty/OAH67nEMnuadhiPTuYHCw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=162noxdT30QFx1o+1e3DPu7w8TySm7LM4jGc0V44tO4PYJ7eOciKErdZs/OYS/F7m azlXig2NqcuBwCSvl2oFjKuZA0xrL1OkNkmmoHgsFSwZyoXYc/AavxsUXq+K2Uf1Az AZvgs3RB6Dc+7SXmZShzsoJZvzFIZs4494JFwSyA= 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 0891/1017] scsi: qla2xxx: Fix hang due to session stuck Date: Tue, 5 Apr 2022 09:30:04 +0200 Message-Id: <20220405070420.677274467@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=-5.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,PDS_OTHER_BAD_TLD, 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 c02aada06d19a215c8291bd968a99a270e96f734 upstream. User experienced device lost. The log shows Get port data base command was queued up, failed, and requeued again. Every time it is requeued, it set the FCF_ASYNC_ACTIVE. This prevents any recovery code from occurring because driver thinks a recovery is in progress for this session. In essence, this session is hung. The reason it gets into this place is the session deletion got in front of this call due to link perturbation. Break the requeue cycle and exit. The session deletion code will trigger a session relogin. Link: https://lore.kernel.org/r/20220310092604.22950-8-njavali@marvell.com Fixes: 726b85487067 ("qla2xxx: Add framework for async fabric discovery") 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_def.h | 4 ++++ drivers/scsi/qla2xxx/qla_init.c | 19 +++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -5438,4 +5438,8 @@ struct ql_vnd_tgt_stats_resp { #include "qla_gbl.h" #include "qla_dbg.h" #include "qla_inline.h" + +#define IS_SESSION_DELETED(_fcport) (_fcport->disc_state == DSC_DELETE_PEND || \ + _fcport->disc_state == DSC_DELETED) + #endif --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -575,6 +575,14 @@ qla2x00_async_adisc(struct scsi_qla_host struct srb_iocb *lio; int rval = QLA_FUNCTION_FAILED; + if (IS_SESSION_DELETED(fcport)) { + ql_log(ql_log_warn, vha, 0xffff, + "%s: %8phC is being delete - not sending command.\n", + __func__, fcport->port_name); + fcport->flags &= ~FCF_ASYNC_ACTIVE; + return rval; + } + if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT)) return rval; @@ -1338,8 +1346,15 @@ int qla24xx_async_gpdb(struct scsi_qla_h struct port_database_24xx *pd; struct qla_hw_data *ha = vha->hw; - if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT) || - fcport->loop_id == FC_NO_LOOP_ID) { + if (IS_SESSION_DELETED(fcport)) { + ql_log(ql_log_warn, vha, 0xffff, + "%s: %8phC is being delete - not sending command.\n", + __func__, fcport->port_name); + fcport->flags &= ~FCF_ASYNC_ACTIVE; + return rval; + } + + if (!vha->flags.online || fcport->flags & FCF_ASYNC_SENT) { ql_log(ql_log_warn, vha, 0xffff, "%s: %8phC online %d flags %x - not sending command.\n", __func__, fcport->port_name, vha->flags.online, fcport->flags);