Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2921297rwb; Mon, 15 Aug 2022 14:05:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR6dXN3yM/9+DxAx2svQEGnmf80dzCG6eC89OaDdBdVFLAH9x3pNORRuZ1Omq9fq1t/09znT X-Received: by 2002:a17:907:e89:b0:730:af06:e345 with SMTP id ho9-20020a1709070e8900b00730af06e345mr11768358ejc.665.1660597539888; Mon, 15 Aug 2022 14:05:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597539; cv=none; d=google.com; s=arc-20160816; b=OEanvmw0wQHt8VhkZ5CKoqOZhXMI0bd/Gz0T41o/0FKZQtOmOHv0//+aITATnPf3dF GTPRkMWEkq+ru7hR4EOa3LejBhW7N//imV54lrXOYZME6T2LbgTdEH2nCsL1RXXLWwrI xY2pzYFXLd5ELAN/gLXbh7yFURKFBICkNENBLgXsr8kQ2SnZSGAjI0sjhXN0aMi1E5+x slKoKPJ9L389/iCUzKIGH65h9JdjrUjop2XcVVxbFWbeRrNxZ7ktSjDLF9cGWEQIm133 WgO6OniWCt3YE4aF4iBEtp2skpf3YYtiwJndZ3qXDjK/Bv2GmrP2210EOwFQ/n5zQZL7 zvZA== 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=iRnO4Gbu3f3QgPQ0ieNsY9Ss+sLwi7jowyERXM6ZyMA=; b=X5GYlHlwYgYcrrXL2BfTulLTdi7gX9+FLl9wtRBcERsbFjXeKWGaNokKrV3+UmxOun iNyQVCUuVL173Oiw2tdq1dLLE/MQWjKhf46AQc8UzaPjoMI3TWyecoFsrUpHWA5ECmGf iM0HivkoK/GJ6zKMr906gbyFxhzLluXFoJIDYNTRFk2lEjzW65e00bklpVXY9xCCNSHf gib8qLkMb+zz70fUnlAKCFFuu8uIClss37hEItNJpYh27y/BZU3fQ25cSHDszmW1+3w/ k0kSTzhAJsVFo5rPFmP/fMHbZDHvJFFAE3+sZwXXaMZlfgIpITBOQJoexaalnCjbvLN0 T5ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="zdfv9y/F"; 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 bu18-20020a170906a15200b007307fd1b9bbsi7407772ejb.589.2022.08.15.14.05.14; Mon, 15 Aug 2022 14:05:39 -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="zdfv9y/F"; 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 S1343658AbiHOTJs (ORCPT + 99 others); Mon, 15 Aug 2022 15:09:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343537AbiHOTGe (ORCPT ); Mon, 15 Aug 2022 15:06:34 -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 B87904F18A; Mon, 15 Aug 2022 11:35:10 -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 0B6D0B8105D; Mon, 15 Aug 2022 18:35:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14424C433C1; Mon, 15 Aug 2022 18:35:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588507; bh=xuBhzV4jFujLSQZDG0nTbqRsXfUJtHiN4aWTe+yiPow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zdfv9y/FVl7WqxznSHJIdSYn13LxpUwJ5+MtsDq+w+cx7j6S9k6H8736stQBR4dHS 9FlWnNl+Hjj+AGpBBpxKo5TlPM9JM3ZeKYyBhj8N4aggSEcU54H9o82FM7S6OpQ/K3 KnVTfxCU7ZuMl4XUZ81fUdrYnHckpuyDGrkWFD7k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 395/779] scsi: qla2xxx: edif: Fix potential stuck session in sa update Date: Mon, 15 Aug 2022 20:00:39 +0200 Message-Id: <20220815180354.155378571@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 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 [ Upstream commit e0fb8ce2bb9e52c846e54ad2c58b5b7beb13eb09 ] When a thread is in the process of reestablish a session, a flag is set to prevent multiple threads/triggers from doing the same task. This flag was left on, and any attempt to relogin was locked out. Clear this flag if the attempt has failed. Link: https://lore.kernel.org/r/20220607044627.19563-6-njavali@marvell.com Fixes: dd30706e73b7 ("scsi: qla2xxx: edif: Add key update") Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/qla2xxx/qla_edif.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edif.c index e42141635377..4be876dd9f6b 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -2187,6 +2187,7 @@ edif_doorbell_show(struct device *dev, struct device_attribute *attr, static void qla_noop_sp_done(srb_t *sp, int res) { + sp->fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); /* ref: INIT */ kref_put(&sp->cmd_kref, qla2x00_sp_release); } @@ -2211,7 +2212,8 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, struct qla_work_evt *e) if (!sa_ctl) { ql_dbg(ql_dbg_edif, vha, 0x70e6, "sa_ctl allocation failed\n"); - return -ENOMEM; + rval = -ENOMEM; + goto done; } fcport = sa_ctl->fcport; @@ -2221,7 +2223,8 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, struct qla_work_evt *e) if (!sp) { ql_dbg(ql_dbg_edif, vha, 0x70e6, "SRB allocation failed\n"); - return -ENOMEM; + rval = -ENOMEM; + goto done; } fcport->flags |= FCF_ASYNC_SENT; @@ -2250,9 +2253,17 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, struct qla_work_evt *e) rval = qla2x00_start_sp(sp); - if (rval != QLA_SUCCESS) + if (rval != QLA_SUCCESS) { rval = QLA_FUNCTION_FAILED; + goto done_free_sp; + } + return rval; +done_free_sp: + kref_put(&sp->cmd_kref, qla2x00_sp_release); + fcport->flags &= ~FCF_ASYNC_SENT; +done: + fcport->flags &= ~FCF_ASYNC_ACTIVE; return rval; } -- 2.35.1