From: Trond Myklebust Date: Sat, 26 Mar 2022 01:51:03 +0000 (-0400) Subject: NFS: Don't loop forever in nfs_do_recoalesce() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d02d81efc7564b4d5446a02e0214a164cf00b1f3;p=linux.git NFS: Don't loop forever in nfs_do_recoalesce() 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 --- diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 3156db526cc45..9157dd19b8b4f 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;