Linux NFS development
 help / color / mirror / Atom feed
From: Jeff Layton <jeff.layton@primarydata.com>
To: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1/5] NFSv4: Fix an atomicity problem in CLOSE
Date: Sat, 24 Jan 2015 06:53:39 -0500	[thread overview]
Message-ID: <20150124065339.75ab68f5@tlielax.poochiereds.net> (raw)
In-Reply-To: <20150124064628.0bc0b289@tlielax.poochiereds.net>

On Sat, 24 Jan 2015 06:46:28 -0500
Jeff Layton <jeff.layton@primarydata.com> wrote:

> On Sat, 24 Jan 2015 00:39:24 -0500
> Trond Myklebust <trond.myklebust@primarydata.com> wrote:
> 
> > If we are to remove the serialisation of OPEN/CLOSE, then we need to
> > ensure that the stateid sent as part of a CLOSE operation does not
> > change after we test the state in nfs4_close_prepare.
> > 
> > Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
> > ---
> >  fs/nfs/nfs4proc.c       | 7 ++++++-
> >  fs/nfs/nfs4xdr.c        | 4 ++--
> >  include/linux/nfs_xdr.h | 2 +-
> >  3 files changed, 9 insertions(+), 4 deletions(-)
> > 
> > diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> > index c347705b0161..4863dec10865 100644
> > --- a/fs/nfs/nfs4proc.c
> > +++ b/fs/nfs/nfs4proc.c
> > @@ -2587,6 +2587,11 @@ static void nfs4_close_done(struct rpc_task *task, void *data)
> >  		case -NFS4ERR_OLD_STATEID:
> >  		case -NFS4ERR_BAD_STATEID:
> >  		case -NFS4ERR_EXPIRED:
> > +			if (!nfs4_stateid_match(&calldata->arg.stateid,
> > +						&state->stateid)) {
> > +				rpc_restart_call_prepare(task);
> > +				goto out_release;
> > +			}
> 
> Do we need a similar check in the open codepath -- possibly in
> nfs4_open_done? AFAICT, currently if the OPEN ends up "losing" the race
> here, then we'll fall into full-on stateid recovery, which is almost
> certainly not what we want.
> 

(facepalm)

Oh nm...stupid q. The OPEN can't lose the race since you won't
necessarily have a stateid at the start of the call, and you're
upgrading anyway.

I think you're correct that CLOSE is the only place you have to worry
about it.

-- 
Jeff Layton <jeff.layton@primarydata.com>

  reply	other threads:[~2015-01-24 11:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-24  5:39 [PATCH 0/5] Parallelise OPEN/OPEN_DOWNGRADE/CLOSE in NFSv4.x (x>0) Trond Myklebust
2015-01-24  5:39 ` [PATCH 1/5] NFSv4: Fix an atomicity problem in CLOSE Trond Myklebust
2015-01-24  5:39   ` [PATCH 2/5] NFSv4: More CLOSE/OPEN races Trond Myklebust
2015-01-24  5:39     ` [PATCH 3/5] NFSv4: Convert nfs_alloc_seqid() to return an ERR_PTR() if allocation fails Trond Myklebust
2015-01-24  5:39       ` [PATCH 4/5] NFSv4: Check for NULL argument in nfs_*_seqid() functions Trond Myklebust
2015-01-24  5:39         ` [PATCH 5/5] NFSv4.1: Allow parallel OPEN/OPEN_DOWNGRADE/CLOSE Trond Myklebust
2015-01-24 11:46   ` [PATCH 1/5] NFSv4: Fix an atomicity problem in CLOSE Jeff Layton
2015-01-24 11:53     ` Jeff Layton [this message]
2015-01-24 11:58 ` [PATCH 0/5] Parallelise OPEN/OPEN_DOWNGRADE/CLOSE in NFSv4.x (x>0) Jeff Layton
2015-01-25 13:19 ` Jeff Layton
2015-01-25 15:14   ` Jeff Layton

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=20150124065339.75ab68f5@tlielax.poochiereds.net \
    --to=jeff.layton@primarydata.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