summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2014-10-13 10:56:12 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-10-30 09:43:10 -0700
commit8897bf1c7fa8b3524bb2cf343d4eb6d9b12204b5 (patch)
tree0437b8b9a8e85f69209bd76ae7c6a6c6a07a05f3
parent56319a855a77bf8df4c87ad9c34cd2c2a538e663 (diff)
downloadlinux-stable-8897bf1c7fa8b3524bb2cf343d4eb6d9b12204b5.tar.gz
linux-stable-8897bf1c7fa8b3524bb2cf343d4eb6d9b12204b5.tar.bz2
linux-stable-8897bf1c7fa8b3524bb2cf343d4eb6d9b12204b5.zip
NFS: Fix a bogus warning in nfs_generic_pgio
commit b8fb9c30f25e45dab5d2cd310ab6913b6861d00f upstream. It is OK for pageused == pagecount in the loop, as long as we don't add another entry to the *pages array. Move the test so that it only triggers in that case. Reported-by: Steve Dickson <SteveD@redhat.com> Fixes: bba5c1887a92 (nfs: disallow duplicate pages in pgio page vectors) Cc: Weston Andros Adamson <dros@primarydata.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/nfs/pagelist.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index d59887f42f45..9229d4780f87 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -744,12 +744,11 @@ int nfs_generic_pgio(struct nfs_pageio_descriptor *desc,
nfs_list_remove_request(req);
nfs_list_add_request(req, &hdr->pages);
- if (WARN_ON_ONCE(pageused >= pagecount))
- return nfs_pgio_error(desc, hdr);
-
if (!last_page || last_page != req->wb_page) {
- *pages++ = last_page = req->wb_page;
pageused++;
+ if (pageused > pagecount)
+ break;
+ *pages++ = last_page = req->wb_page;
}
}
if (WARN_ON_ONCE(pageused != pagecount))