Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp774938pxb; Tue, 5 Apr 2022 22:48:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6nQhkzDQHsRTH9rNcPTeiffqUO2Yl9WUJXQWOcUpLBwTMeABATT6iY7ZbyRIKdNCl5ODv X-Received: by 2002:a63:384e:0:b0:374:ae28:71fc with SMTP id h14-20020a63384e000000b00374ae2871fcmr5743318pgn.159.1649224117110; Tue, 05 Apr 2022 22:48:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649224117; cv=none; d=google.com; s=arc-20160816; b=Q40eay+sd9vXkRztH/AiakH9CjlHmwf27FOXtJSdeJwY8r+kXwbpn1GJAKu7+7K/eK 8j0X5NvfImVKfdwbWC58jY5yei1s2wpIBvm12XpZn7UgSlauA481F+Gcn6qSPmnhvNoO mf6Yg+o4vut1xapS0+YeVLg2DThDQ0t/m/0B0ddjXPuGDSBQzaXfLzuLqICfYeUYDlrA Jxnd9kyJY5BFgoB1pdW6ydz/+cwleHcLQmTT6V6ghsZwhGzZC4YpInfzJ5HGwRVsb0XJ dtdgERME9LDOhSwp19pCRSUjZy46cLTrm57FVDdvaQ07LkIrSZ/k65EzZ9gq34p/Aw+u Mm6A== 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=0rgFIR2vlHeOjW1UtK9oPkBns9/8P5MZdu3mjmmXFFs=; b=xA+SJLnjnOOPA5xeueXX/WRmbva6UZwQtoZYT+39XZ/ByjR8/kEVk9qDzW2gx+xRUP kDvdSq/87P2zkXr9Yv8IccKen8M2DiThNavpAs2rt2ONV0McYyXGPA4Rv5tidYrUKVJ3 73BJAuznAf07zAv7MM9S/paEge2oKxyqn6em6Spd/wmBk0pNz4tlqZ93+iaFwAUMRspm N97fFLFO2Ou8M+XY9ZPhRAaxq26gcH3yVn20UwPz7Yqnlg4pG/Kotg24wl4SmUHmKHEd Ev5EXhUVwebC/rQ1eepb2Cee6okBlIhxfuuoWExSQ3OFGbE4MaQ6WIg8zemb/iXI7FcJ vmaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tKihyMVY; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id u6-20020a17090341c600b00153b32082afsi16316286ple.266.2022.04.05.22.48.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 22:48:37 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tKihyMVY; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BD1B94984BF; Tue, 5 Apr 2022 22:20:53 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1579389AbiDEXaq (ORCPT + 99 others); Tue, 5 Apr 2022 19:30:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353527AbiDEKIF (ORCPT ); Tue, 5 Apr 2022 06:08:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60F8CC1C88; Tue, 5 Apr 2022 02:55:13 -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 CED236157A; Tue, 5 Apr 2022 09:55:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1FD3C385A2; Tue, 5 Apr 2022 09:55:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649152512; bh=49fx9Rn8aFKO5SR5l9/zdVWbtpC5hrbzgTPm2hvj6K4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tKihyMVYNeEDsUR10UjOWwMu/xCRklIYSiX4aFJqBrLajstJB+p7S3Bs7vxB5zSja 7uGg/QXJnh2GW2odAdn8XlR9q5z/CK95O9hJvHKgnPBq9oF3ZHlf02zicWJaBpVxKT 1hhjpSzfFSxyFIxYBMxVXLoyb3XyLfwC2EVJlxWU= 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 803/913] scsi: qla2xxx: Fix hang due to session stuck Date: Tue, 5 Apr 2022 09:31:05 +0200 Message-Id: <20220405070403.902299095@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=0.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD,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 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 @@ -576,6 +576,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; @@ -1339,8 +1347,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);