diff options
author | Trond Myklebust <trond.myklebust@hammerspace.com> | 2019-08-12 15:19:54 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-09-06 10:21:00 +0200 |
commit | ae63bd38d03afe36ba0b6d0b6f6fea0157d79718 (patch) | |
tree | 9983999aee0070441a40e641d6b736973bb76b2c | |
parent | fc26de15b5d840286dbd8dac7048897d0699f611 (diff) | |
download | linux-stable-ae63bd38d03afe36ba0b6d0b6f6fea0157d79718.tar.gz linux-stable-ae63bd38d03afe36ba0b6d0b6f6fea0157d79718.tar.bz2 linux-stable-ae63bd38d03afe36ba0b6d0b6f6fea0157d79718.zip |
NFSv4/pnfs: Fix a page lock leak in nfs_pageio_resend()
[ Upstream commit f4340e9314dbfadc48758945f85fc3b16612d06f ]
If the attempt to resend the pages fails, we need to ensure that we
clean up those pages that were not transmitted.
Fixes: d600ad1f2bdb ("NFS41: pop some layoutget errors to application")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Cc: stable@vger.kernel.org # v4.5+
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | fs/nfs/pagelist.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index a7aa028a5b0b..ae598e45b2df 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -1231,20 +1231,22 @@ static void nfs_pageio_complete_mirror(struct nfs_pageio_descriptor *desc, int nfs_pageio_resend(struct nfs_pageio_descriptor *desc, struct nfs_pgio_header *hdr) { - LIST_HEAD(failed); + LIST_HEAD(pages); desc->pg_io_completion = hdr->io_completion; desc->pg_dreq = hdr->dreq; - while (!list_empty(&hdr->pages)) { - struct nfs_page *req = nfs_list_entry(hdr->pages.next); + list_splice_init(&hdr->pages, &pages); + while (!list_empty(&pages)) { + struct nfs_page *req = nfs_list_entry(pages.next); if (!nfs_pageio_add_request(desc, req)) - nfs_list_move_request(req, &failed); + break; } nfs_pageio_complete(desc); - if (!list_empty(&failed)) { - list_move(&failed, &hdr->pages); - return desc->pg_error < 0 ? desc->pg_error : -EIO; + if (!list_empty(&pages)) { + int err = desc->pg_error < 0 ? desc->pg_error : -EIO; + hdr->completion_ops->error_cleanup(&pages, err); + return err; } return 0; } |