]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
NFS: Don't loop forever in nfs_do_recoalesce()
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Sat, 26 Mar 2022 01:51:03 +0000 (21:51 -0400)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 27 Apr 2022 09:58:16 +0000 (11:58 +0200)
BugLink: https://bugs.launchpad.net/bugs/1969110
[ 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 <aglo@umich.edu>
Fixes: 70536bf4eb07 ("NFS: Clean up reset of the mirror accounting variables")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit c95578235888431e61d36f212ad2236e0ff8b90f)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
fs/nfs/pagelist.c

index cc232d1f16f2f9016620a70b642ff80bbdda5080..b1130dc200d2c17b66043c722685eede560a7cc4 100644 (file)
@@ -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;