Message ID | 1413212839-6665-2-git-send-email-trond.myklebust@primarydata.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Oct 13, 2014, at 11:07 AM, Trond Myklebust <trond.myklebust@primarydata.com> wrote: > 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> > --- > fs/nfs/pagelist.c | 7 +++---- > 1 file 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, > 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; This looks right. Thanks Trond! -dros > } > } > if (WARN_ON_ONCE(pageused != pagecount)) > -- > 1.9.3 > -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 10/13/2014 11:07 AM, Trond Myklebust wrote: > 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> Tested-by: Steve Dickson <steved@redhat.com> steved. > --- > fs/nfs/pagelist.c | 7 +++---- > 1 file 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, > 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)) > -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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, 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))
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> --- fs/nfs/pagelist.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)