NFS: Fix an Oopsable condition in __nfs_pageio_add_request()
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Tue, 25 May 2021 14:23:05 +0000 (10:23 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Jun 2021 07:00:36 +0000 (09:00 +0200)
commitee21cd3aa8548e0cbc8c67a80b62113aedd2d101
treeecdd8b2b1192db0ffdaf0591a0a4e045b583f899
parent9b367fe770b1b80d7bf64ed0d177544a44405f6e
NFS: Fix an Oopsable condition in __nfs_pageio_add_request()

commit 56517ab958b7c11030e626250c00b9b1a24b41eb upstream.

Ensure that nfs_pageio_error_cleanup() resets the mirror array contents,
so that the structure reflects the fact that it is now empty.
Also change the test in nfs_pageio_do_add_request() to be more robust by
checking whether or not the list is empty rather than relying on the
value of pg_count.

Fixes: a7d42ddb3099 ("nfs: add mirroring support to pgio layer")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfs/pagelist.c