Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp988064pxb; Wed, 6 Apr 2022 06:07:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDTi6Z/R0g31uv7K2oiPRYI8u3LUrW1naH5pdGxh8wq8bZ8+018WjQthRF7TjHZZALah4E X-Received: by 2002:a17:90a:4590:b0:1bc:4afa:1778 with SMTP id v16-20020a17090a459000b001bc4afa1778mr9907653pjg.14.1649250433895; Wed, 06 Apr 2022 06:07:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649250433; cv=none; d=google.com; s=arc-20160816; b=CnUAIeM7cP31BEQ9l3kYb7qOfSh4ERLQ/wQsUSlawHYBk+X4G5d1RQRAKzuG8RYwTL MQ/yGVqLA3cvn9vRtDga6QcfWRHoMGJ0p5LxxjFt7AHBfCkeA6Z8qt0lphor90cV9EXm QikIJVD+YQrPUYSZtuvd36KWTW4S9t0NAS7Pc02BeTt0kru3Y3YE8ksKcRzcUVb4stzV CDXXIZ/rKchlx9eS1D6DPUgwMWtW4fY3qJuSPM7f2TMyuN3jF3eBYb6I9RDyTcA9GlSJ eiK6gddmfCbk930HloiBewJ0FdNLeLFGXcu64yOiRwlcRLl1umEdiwOdc6XRZZCxvKVm kT5Q== 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=bJBnVTX8M9P2zjj/6UFwFikkzVOJGcgaBf9H+geCrLo=; b=vZ1Y58GmEVM6eVqpt7SdmPdd7rlEj9w5LljFhnDLEy1QJo2vWu0Wu0KSmkV2JKqe5G mlXP1uDVBT0bwjWO0AaCAMkcae8u83qKHKJCCov79EKkzAD/cnl8PkU9LnKYIb2i9pLC nOFD7+TJqa03og8efYkwD+fp0DhDa3yFW23Ecr1X7aGH3Oigi2B0gRY0+rA9eUkwkKkR VlxMan/6IXKylT30bPxthipOfw4isSuPwf3L5hTU2EQFYBSw5rMj/qpgTrOxhv89+cIo g5WYWrpRFw07jkEqt9JYmoN/+mFL7HSOu/+wkqoClhHXacfvL7J3NWFgPHkpql03nazb pjxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="EPeW/YXO"; 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 q132-20020a632a8a000000b00381640eeca2si15404890pgq.4.2022.04.06.06.07.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 06:07:13 -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="EPeW/YXO"; 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 8AF465ABDB4; Wed, 6 Apr 2022 03:29:13 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1846513AbiDFCEg (ORCPT + 99 others); Tue, 5 Apr 2022 22:04:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349669AbiDEJux (ORCPT ); Tue, 5 Apr 2022 05:50:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC4862AD2; Tue, 5 Apr 2022 02:48:54 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 6A5436164D; Tue, 5 Apr 2022 09:48:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77D40C385A2; Tue, 5 Apr 2022 09:48:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649152133; bh=tYBNv+Rr8wh+iAJ7nZMKqWcKvB1KnhDg52VIlRPlvfU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EPeW/YXOaUJUCtGs8P5Q7XjBSiheMg0M6D4debqO+NggBoCDFYkqBSOM6F8g5UzaT mSwp790ekTz0gFVLSFp99J4LmmtRjXVDV/JEQcxRq1dNLp1j3j/2bZNQcqWkqiVBzr x56/xYXoBi3D83EwkcyUbicfky33nzZMKv38XRxg= 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.15 668/913] NFS: Dont loop forever in nfs_do_recoalesce() Date: Tue, 5 Apr 2022 09:28:50 +0200 Message-Id: <20220405070359.859072976@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: 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 cc232d1f16f2..b1130dc200d2 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -1227,6 +1227,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