From: Jeff Layton <jlayton@redhat.com>
To: Trond Myklebust <trond.myklebust@primarydata.com>,
linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1/4] pNFS: Fix post-layoutget error handling in pnfs_update_layout()
Date: Fri, 15 Jul 2016 10:45:35 -0400 [thread overview]
Message-ID: <1468593935.3584.6.camel@redhat.com> (raw)
In-Reply-To: <1468537115-65826-1-git-send-email-trond.myklebust@primarydata.com>
On Thu, 2016-07-14 at 18:58 -0400, Trond Myklebust wrote:
> The non-retry error path is currently broken and ends up releasing the
> reference to the layout twice. It also can end up clearing the
> NFS_LAYOUT_FIRST_LAYOUTGET flag twice, causing a race.
>
> In addition, the retry path will fail to decrement the plh_outstanding
> counter.
>
> Fixes: 183d9e7b112aa ("pnfs: rework LAYOUTGET retry handling")
> Cc: stable@vger.kernel.org # 4.7
> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
> ---
> fs/nfs/pnfs.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
> index 0fbe734cc38c..73b0dc90265a 100644
> --- a/fs/nfs/pnfs.c
> +++ b/fs/nfs/pnfs.c
> @@ -1645,6 +1645,7 @@ lookup_again:
> lseg = send_layoutget(lo, ctx, &stateid, &arg, &timeout, gfp_flags);
> trace_pnfs_update_layout(ino, pos, count, iomode, lo, lseg,
> PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET);
> + atomic_dec(&lo->plh_outstanding);
> if (IS_ERR(lseg)) {
> switch(PTR_ERR(lseg)) {
> case -ERECALLCONFLICT:
> @@ -1652,26 +1653,25 @@ lookup_again:
> lseg = NULL;
> /* Fallthrough */
> case -EAGAIN:
> - pnfs_put_layout_hdr(lo);
> - if (first)
> - pnfs_clear_first_layoutget(lo);
> - if (lseg) {
> - trace_pnfs_update_layout(ino, pos, count,
> - iomode, lo, lseg, PNFS_UPDATE_LAYOUT_RETRY);
> - goto lookup_again;
> - }
> - /* Fallthrough */
> + break;
> default:
> if (!nfs_error_is_fatal(PTR_ERR(lseg))) {
> pnfs_layout_clear_fail_bit(lo, pnfs_iomode_to_fail_bit(iomode));
> lseg = NULL;
> }
> }
> + if (lseg) {
> + pnfs_put_layout_hdr(lo);
> + if (first)
> + pnfs_clear_first_layoutget(lo);
> + trace_pnfs_update_layout(ino, pos, count,
> + iomode, lo, lseg, PNFS_UPDATE_LAYOUT_RETRY);
> + goto lookup_again;
> + }
> } else {
> pnfs_layout_clear_fail_bit(lo, pnfs_iomode_to_fail_bit(iomode));
> }
>
> - atomic_dec(&lo->plh_outstanding);
> out_put_layout_hdr:
> if (first)
> pnfs_clear_first_layoutget(lo);
The whole set looks good to me. Nice catches all around!
Reviewed-by: Jeff Layton <jlayton@redhat.com>
prev parent reply other threads:[~2016-07-15 14:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-14 22:58 [PATCH 1/4] pNFS: Fix post-layoutget error handling in pnfs_update_layout() Trond Myklebust
2016-07-14 22:58 ` [PATCH 2/4] pNFS: Separate handling of NFS4ERR_LAYOUTTRYLATER and RECALLCONFLICT Trond Myklebust
2016-07-14 22:58 ` [PATCH 3/4] pNFS: Handle NFS4ERR_RECALLCONFLICT correctly in LAYOUTGET Trond Myklebust
2016-07-14 22:58 ` [PATCH 4/4] pNFS: Fix LAYOUTGET handling of NFS4ERR_BAD_STATEID and NFS4ERR_EXPIRED Trond Myklebust
2016-07-15 14:38 ` [PATCH 2/4] pNFS: Separate handling of NFS4ERR_LAYOUTTRYLATER and RECALLCONFLICT Jeff Layton
2016-07-14 23:15 ` [PATCH 1/4] pNFS: Fix post-layoutget error handling in pnfs_update_layout() Trond Myklebust
2016-07-15 14:45 ` Jeff Layton [this message]
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=1468593935.3584.6.camel@redhat.com \
--to=jlayton@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;
as well as URLs for NNTP newsgroup(s).