Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp722467pxb; Tue, 5 Apr 2022 20:21:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsSVYoGTB0/7JhIzWc32cwpgBz7TxuHGa3rxO8R7kPHk6ZcgwPVQFu+qMiOFgy8IttMGWw X-Received: by 2002:a17:902:f212:b0:156:a80c:e10d with SMTP id m18-20020a170902f21200b00156a80ce10dmr6570301plc.11.1649215276571; Tue, 05 Apr 2022 20:21:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649215276; cv=none; d=google.com; s=arc-20160816; b=TKtDWW2CRmvA+1vUdCpM5ZH3xGbVVnunOsWWdsMvMKjJQZ07qtvv/oQMT0uCZtrHxo Q4sNi44FCAt7eSinNA12rYwK1vUwHyArkK1kZfVZ4jsmKcbBxkO9Wne4Faed2UYgODZU 2UOxz5/vz85yGG4OCN53nG6fYjEyvafSsOTArdGACh6euGY9xcSa9SzbCOccCpvPEJFi okxDsPQ6KlQu7YRs1l8WAeCJFVQQ1ziGH2tBs5ighnsIFpC3HDn8b50wB+oZyMbSFyJW rhcI80wEnaRFIAzgSHq/ry46cVdOV90ZEQhwZRuf7cQRiGNdUqdlwiRSm+yAODhNN0Vk EHvQ== 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=zjvILKSV2bBPJskXqlCFQ395DSMqlG5Eu/HLNwoEpvQ=; b=Cp/3Stc9qe50JdB4Z/0on+klI2g4k7aN46VehqjG/IWO7ghDArvpqZaSkuTHo3BpCL oVG8gt1C+BWpw4P7IALj4I0LzdnwbTnJ+UbqhfJJ6eOp0QBh2WVXsaUGeJ8cRAVw2DFR Xzp36RXa3cnetNqkoJc9FLftM5a7EI70SxaTwyxuA7fLQto6Fo7+Cq9/XGRNYoNY4ArE g8AdDkTzXsB6uFcrkr+dtU4oDta+jJ9ldPE/zdWSX6yvH3me/aGrRIEoOSMdQpHQ9WBy vsCpFRIvpoqm6EkKWDpoG7X6HPaxygNrYEo/uP1wiBlwzvGNFeSbFje4fOAKWU7LlIJk y2NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m2KeLeVv; 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 z10-20020a170902ccca00b001567d82c09asi10929528ple.174.2022.04.05.20.21.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 20:21:16 -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=m2KeLeVv; 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 7480F309718; Tue, 5 Apr 2022 19:55:33 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347952AbiDEJ2u (ORCPT + 99 others); Tue, 5 Apr 2022 05:28:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239558AbiDEIUO (ORCPT ); Tue, 5 Apr 2022 04:20:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D34825FA; Tue, 5 Apr 2022 01:16:15 -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 B8172B81B90; Tue, 5 Apr 2022 08:16:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09A96C385A2; Tue, 5 Apr 2022 08:16:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649146572; bh=Uuc8TI2J6LCVOUkBalK+gztZd5pAzXYyYOxYGnUtsdc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m2KeLeVvLOWY/k3dZdJhDAj07Xzj8XTre9F3oCi13Dq+bhh9xTbYa/YvlLyCREd0F c2cEzsdRCT+IM7aRcygzMb83vEqzjbt1H8fPkCwjRYGbIV6ckmvllbA420uLxigGtw 1plICUY689F3UQjtBDITJr5DH1LnAC54XuRa0pCE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olga Kornievskaia , Trond Myklebust , Sasha Levin Subject: [PATCH 5.17 0813/1126] NFS: Dont loop forever in nfs_do_recoalesce() Date: Tue, 5 Apr 2022 09:26:00 +0200 Message-Id: <20220405070431.427748233@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=-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: Trond Myklebust [ Upstream commit d02d81efc7564b4d5446a02e0214a164cf00b1f3 ] If __nfs_pageio_add_request() fails to add the request, it will return with either desc->pg_error < 0, or mirror->pg_recoalesce will be set, so we are guaranteed either to exit the function altogether, or to loop. However if there is nothing left in mirror->pg_list to coalesce, we must exit, so make sure that we clear mirror->pg_recoalesce every time we loop. Reported-by: Olga Kornievskaia Fixes: 70536bf4eb07 ("NFS: Clean up reset of the mirror accounting variables") Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- fs/nfs/pagelist.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index ad7f83dc9a2d..815d63080245 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -1218,6 +1218,7 @@ static int nfs_do_recoalesce(struct nfs_pageio_descriptor *desc) do { list_splice_init(&mirror->pg_list, &head); + mirror->pg_recoalesce = 0; while (!list_empty(&head)) { struct nfs_page *req; -- 2.34.1