Skip to content

Commit

Permalink
NFS: Don't loop forever in nfs_do_recoalesce()
Browse files Browse the repository at this point in the history
[ Upstream commit d02d81e ]

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: 70536bf ("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>
  • Loading branch information
Trond Myklebust authored and gregkh committed Apr 8, 2022
1 parent 72b9d45 commit fc31fa1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/nfs/pagelist.c
Expand Up @@ -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;
Expand Down

0 comments on commit fc31fa1

Please sign in to comment.