public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Weston Andros Adamson <dros@primarydata.com>
To: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: Steve Dickson <SteveD@redhat.com>,
	linux-nfs list <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH 2/2] NFS: Fix a bogus warning in nfs_generic_pgio
Date: Mon, 13 Oct 2014 11:25:43 -0400	[thread overview]
Message-ID: <A509B179-9699-403D-AF0B-6212474C6EDA@primarydata.com> (raw)
In-Reply-To: <1413212839-6665-2-git-send-email-trond.myklebust@primarydata.com>

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
> 


  reply	other threads:[~2014-10-13 15:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-13 15:07 [PATCH 1/2] NFS: Fix an uninitialised pointer Oops in the writeback error path Trond Myklebust
2014-10-13 15:07 ` [PATCH 2/2] NFS: Fix a bogus warning in nfs_generic_pgio Trond Myklebust
2014-10-13 15:25   ` Weston Andros Adamson [this message]
2014-10-14 21:22   ` Steve Dickson
2014-10-14 21:22 ` [PATCH 1/2] NFS: Fix an uninitialised pointer Oops in the writeback error path Steve Dickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A509B179-9699-403D-AF0B-6212474C6EDA@primarydata.com \
    --to=dros@primarydata.com \
    --cc=SteveD@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@primarydata.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox