Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1010701pxb; Wed, 6 Apr 2022 06:39:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8nIKYy1LT4fcmUj09DxRJ0YvtX7IjqRQE+LUVyXjntM2FS6aCMU8f6Df7NBKf0zDCbWob X-Received: by 2002:a17:902:cecf:b0:154:2177:26be with SMTP id d15-20020a170902cecf00b00154217726bemr8815533plg.96.1649252380752; Wed, 06 Apr 2022 06:39:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649252380; cv=none; d=google.com; s=arc-20160816; b=Jzl8kt2yYRNZPvqWUZzDL3ZzLSJl9GXoOmzSuPFkxkA6l0AjeOOMbHMyrB3BT6gJ1/ juVMetbwyybfkTwCWkEkLukIm2UoPqawJPsZoUaR7QA47ytLoO85bgjtaaOVRFL3hdXB rwVrptey8Y3XsMswMiTwFIhmXKo/yRZXVG2fQ9txOLiFwbM8BTimn11MSM6ODzt3tH2i NZd4Q96eNjTwDyD4yXC8Dn58HJmQ4I33pMjulA0vqurSNxlJOE1DoOkmWYtMs43lsKyV tkAZxVNgB0+iAj9CpfEw0cqnRC0/9IOGMt0tReUGY057SIOcLroMRipot6R8Covx3tmn iWrA== 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=hxak0hd4WRe2UCVW38uROLSybCHH9UVPk99hs3yd2Sw=; b=R2Kr4Q9CC1AuAfq0B9kW/WbuDqrNSY3E72Bpg8qSBDuSVu5849pF06CqYd2AgwkH+x OikPdhaZ46ur/WXMfxZe0xo4scjp5x2YexciURqKXJcoL2fZw/DYxvOS3KPIsEJm0Iym mVDvg8hmtCPuptG9FdTY0qFITy+9hV19EfSOYpPUoaENnMJsQfIBB1JFtbnV1+ZJUf+f PS3+DhpAZQBBMFC01neAuQDRwThcmDKnR18TY+bA+o1gUuIEVJeBTfsOhwALsxf2zwg2 CPGtAASFD1zp/SKHZ/Mb06Y2oG8czuLRxkZgtSrnBGj172STu5ymy+Os4XoXjzTXNWEW 40jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MZPPJBgI; 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 23-20020a630d57000000b003816043ef90si16159098pgn.389.2022.04.06.06.39.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 06:39:40 -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=MZPPJBgI; 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D3BE055A9A4; Wed, 6 Apr 2022 04:25:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1455390AbiDFAn0 (ORCPT + 99 others); Tue, 5 Apr 2022 20:43:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354195AbiDEKMP (ORCPT ); Tue, 5 Apr 2022 06:12:15 -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 67AF452E7C; Tue, 5 Apr 2022 02:58:24 -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 2A097B81B18; Tue, 5 Apr 2022 09:58:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92BE2C385A1; Tue, 5 Apr 2022 09:58:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649152701; bh=n6zyPSIkFvCLdD5kBxfGwkFctlLJmjTygZHO/L9jPmc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MZPPJBgI9AIlOcBs/rK/flSSH3mO4pmSTfyfUjR0r6P/UOnveedrYERVu5V2RJpPQ EaSsFmNC3xv5WylzvHaF1cf+sUbT1Bb0qvtKWXUqxwP+hzyt3qUjAnZAhf+QoXesfO i4rCA+YSr6d1CwSlWwyW+o6rpZcV+bvRb1rVokd0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ewan Milne , Himanshu Madhani , Saurav Kashyap , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.15 865/913] scsi: qla2xxx: Add qla2x00_async_done() for async routines Date: Tue, 5 Apr 2022 09:32:07 +0200 Message-Id: <20220405070405.752209504@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: Saurav Kashyap commit 49b729f58e7a98a006a8a0c1dcca8a1a4f58d2a8 upstream. This done routine will delete the timer and check for its return value and decrease the reference count accordingly. This prevents boot hangs reported after commit 31e6cdbe0eae ("scsi: qla2xxx: Implement ref count for SRB") was merged. Link: https://lore.kernel.org/r/20220208093946.4471-1-njavali@marvell.com Fixes: 31e6cdbe0eae ("scsi: qla2xxx: Implement ref count for SRB") Reported-by: Ewan Milne Tested-by: Ewan D. Milne Reviewed-by: Himanshu Madhani Signed-off-by: Saurav Kashyap Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/qla2xxx/qla_iocb.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -2560,6 +2560,20 @@ qla24xx_tm_iocb(srb_t *sp, struct tsk_mg } } +static void +qla2x00_async_done(struct srb *sp, int res) +{ + if (del_timer(&sp->u.iocb_cmd.timer)) { + /* + * Successfully cancelled the timeout handler + * ref: TMR + */ + if (kref_put(&sp->cmd_kref, qla2x00_sp_release)) + return; + } + sp->async_done(sp, res); +} + void qla2x00_sp_release(struct kref *kref) { @@ -2573,7 +2587,8 @@ qla2x00_init_async_sp(srb_t *sp, unsigne void (*done)(struct srb *sp, int res)) { timer_setup(&sp->u.iocb_cmd.timer, qla2x00_sp_timeout, 0); - sp->done = done; + sp->done = qla2x00_async_done; + sp->async_done = done; sp->free = qla2x00_sp_free; sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout; sp->u.iocb_cmd.timer.expires = jiffies + tmo * HZ;