Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp605256pxb; Tue, 5 Apr 2022 15:42:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzx3L2gvhMixD6GkuAmzKQ1fiVJGkM1nhXczV3rkhUPxNr9YMpY/sJjB+luq/pQf2ifwkiq X-Received: by 2002:a17:90a:b903:b0:1ca:be37:1d41 with SMTP id p3-20020a17090ab90300b001cabe371d41mr6581981pjr.9.1649198564017; Tue, 05 Apr 2022 15:42:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649198564; cv=none; d=google.com; s=arc-20160816; b=mBOpRVkQ3BTTOyf+UJrl7SxDJ4GQF85PLxjWWT2HlnBIZVBw3LzWdeEHA5BBSbG5vv UJrvyMWc0VoMhZunHZnuOZZwGuknDv0HQro/EKQ59ZLXTjvUmgwidsyDsyPduoms7846 37Q7Wz66dTn1pQA7fbVNm3ptOiuxhnj/E2mXQ4/eYMfzTkrjcLxmnShenkFE1cFFOry6 IvfwpnpJOq7em3oFhAjiFqhkdnx0jC6zcZD7JTNkHZzNcieGyvJx0zFo3GxtclxZIYI/ KoVH4N0ZKq5mAfCgUVhHR70Izk0qscgj5duITWEUkUo3vZzrF6BcVLoG5+MSXh7vG8eu 2/Eg== 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=MD6LwCr3aCfoF4qIduf4jYnJDRx7QBnqRzklvYt+3Y42r9mI4VMiVtrmxt7X8E7R2/ KFjThBauEY7aELG/MlIwkd6cFb30KhwKb4ApDATkn7RBzNdjfNGXYLZJtkhIeNqVv/Zm l/IGqaARGVREtSOwe1tgE+7SrJPp6u2AX/CXZw6AIkdpqD7Cqtl5Wbyo/xSPKPdklc3P 5zWGjyxRFi0GvhHY+zgqpDDfgMamAgyJ9mmUY0NjaQLItbM38sbnIJtt/eeCj2hghaXl BLzQecv/nqS1GXrgiFNatF/thy7kdo6l8XeMXZuVUQrP9ClPRo+QnC7eNzL3yiEYdCry 9HMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XIt2SK29; 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 p22-20020a056a000b5600b004fab35f2191si15303791pfo.194.2022.04.05.15.42.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 15:42:44 -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=XIt2SK29; 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 932095D653; Tue, 5 Apr 2022 15:23:26 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354705AbiDEOCR (ORCPT + 99 others); Tue, 5 Apr 2022 10:02:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235407AbiDEJaT (ORCPT ); Tue, 5 Apr 2022 05:30:19 -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 1C73140A1C; Tue, 5 Apr 2022 02:17:09 -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 C6527B818F3; Tue, 5 Apr 2022 09:17:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E284C385A0; Tue, 5 Apr 2022 09:17:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649150226; bh=n6zyPSIkFvCLdD5kBxfGwkFctlLJmjTygZHO/L9jPmc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XIt2SK294Pob+ktIQMU7QpASBAtcYIUic2T6S6Wphscwc0IiI8+ZG2WftKzkb3Ifn UgTetWlHHgwch7YIBpVDHABDf6q9tc4uRqUv7IYC9r5U5pqcTOe8lB60mZj7jcufzT iYQ3AcVNMjfcmEK7Ly2hTRI6NCZJvcxJxhFMYtcU= 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.16 0962/1017] scsi: qla2xxx: Add qla2x00_async_done() for async routines Date: Tue, 5 Apr 2022 09:31:15 +0200 Message-Id: <20220405070422.762944523@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=-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;