diff options
| author | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-10-13 10:56:12 -0400 |
|---|---|---|
| committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-10-13 11:04:02 -0400 |
| commit | b8fb9c30f25e45dab5d2cd310ab6913b6861d00f (patch) | |
| tree | d21470fdb513dd9a0f8160dbbdb9405a7751ce27 | |
| parent | 3caa0c6ed754d91b15266abf222498edbef982bd (diff) | |
NFS: Fix a bogus warning in nfs_generic_pgio
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>
Cc: stable@vger.kernel.org # 3.16.x
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
| -rw-r--r-- | fs/nfs/pagelist.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 08085de879ed..ed0db61f8543 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c | |||
| @@ -752,12 +752,11 @@ int nfs_generic_pgio(struct nfs_pageio_descriptor *desc, | |||
| 752 | nfs_list_remove_request(req); | 752 | nfs_list_remove_request(req); |
| 753 | nfs_list_add_request(req, &hdr->pages); | 753 | nfs_list_add_request(req, &hdr->pages); |
| 754 | 754 | ||
| 755 | if (WARN_ON_ONCE(pageused >= pagecount)) | ||
| 756 | return nfs_pgio_error(desc, hdr); | ||
| 757 | |||
| 758 | if (!last_page || last_page != req->wb_page) { | 755 | if (!last_page || last_page != req->wb_page) { |
| 759 | *pages++ = last_page = req->wb_page; | ||
| 760 | pageused++; | 756 | pageused++; |
| 757 | if (pageused > pagecount) | ||
| 758 | break; | ||
| 759 | *pages++ = last_page = req->wb_page; | ||
| 761 | } | 760 | } |
| 762 | } | 761 | } |
| 763 | if (WARN_ON_ONCE(pageused != pagecount)) | 762 | if (WARN_ON_ONCE(pageused != pagecount)) |
