Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp673703pxb; Tue, 5 Apr 2022 18:13:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwP5ahsUpE6zmMvyOibUwjPzPh3ceEZ1coEIHdebGtexpjecDhByWFYAv3rhd4wLqgeE3p1 X-Received: by 2002:a17:90b:4c49:b0:1c7:d6c1:bb0f with SMTP id np9-20020a17090b4c4900b001c7d6c1bb0fmr7117201pjb.230.1649207618811; Tue, 05 Apr 2022 18:13:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649207618; cv=none; d=google.com; s=arc-20160816; b=tW0pB55I9LJp4zxRIqtJLpFmux0IPaNVbgYZxjiWlSbpMS3fy/tHYfixIKftwnatMm bai37heIOKVaMSOI43hb/4FNLQ/e3yihG/DZNcFaCURAmZHjnz0T0VqZOidEvlLiGHUk XFz1kx+BBR6HEL0sji94WzXas3iocn0FnzJ6bVFgGDZZ6UUT9iarAojTB49mNWZjuC3+ ueer7aRjNhuoiamf3zBw6QRW/9y6Wny7pV3wmkDZun7gG+pLtYBBBsSiSOnhEuho70pW k70FmW1MBVNTm104rhZqDxEIWM5artlj8jaw+cpSLnz0fZ+1DXZkAZMEPui41TKUPak4 ZVGw== 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=v8bc4a4Xanmi2jDJ3ctsS9T4b1R64Wmwyuv6m5J23u9WyI8BS/5HZux3melK+U6J99 vhfDKLAeU9odqPDnFr/mRXCHPT0+RbTQX7gN86do3IQVqhl3apn7AtbhwIJby9ccrjpB wh+tuG6a2Sntn3hqcyMRVQrE9Zdm3EwI6Xp87xyBM0q0ODVj9eMhXUDtepKdNn+aZypx LAQ7VZTDemNu355CTlqC28mIUZmnGMDbW/cJ3hZR7E6QsdrsyFGyqmmFgIDrt3wSYu/U BY9SSUNt1E9chEDNup3mzgxATVHa7h49+1Pa1KywlxfHDxUgoIcCnfLqEuQuVclTs5Gc cP9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sZyttx8U; 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 e29-20020a63371d000000b003816043efd6si14485397pga.459.2022.04.05.18.13.24; Tue, 05 Apr 2022 18:13:38 -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=sZyttx8U; 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 S1353350AbiDEKGB (ORCPT + 99 others); Tue, 5 Apr 2022 06:06:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240541AbiDEIcG (ORCPT ); Tue, 5 Apr 2022 04:32:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F4387304C; Tue, 5 Apr 2022 01:24:33 -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 B2E35B81BBF; Tue, 5 Apr 2022 08:24:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2504CC385A0; Tue, 5 Apr 2022 08:24:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649147056; bh=xOIsufLeQocMH3kgT/ty/OAH67nEMnuadhiPTuYHCw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sZyttx8UxaItoYaJ/hJst5YBJes105Yol2KCaeo9Tu8rrAgJ0mJYcsS3qtc0QpHdS HoEnZhjd+9M1i+TUV8abvJCeAMjkp7+Ko0imICij9fkIv0hK8hXu4iF3YKTIVmAbpr 0TdEBmRkTXJbo9lm/jMfPRnwhL9yr7QAw9CZB+ok= 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.17 0986/1126] scsi: qla2xxx: Fix hang due to session stuck Date: Tue, 5 Apr 2022 09:28:53 +0200 Message-Id: <20220405070436.438085056@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@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);