From: Trond Myklebust <trondmy@hammerspace.com>
To: "smayhew@redhat.com" <smayhew@redhat.com>,
"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>
Subject: Re: Question about open(CLAIM_FH)
Date: Thu, 18 Apr 2019 15:26:43 +0000 [thread overview]
Message-ID: <2cb06c38ec956753eaf882dd30053f11532f5608.camel@hammerspace.com> (raw)
In-Reply-To: <213d4ead8a7ae890dadc7785d59117e798f94748.camel@hammerspace.com>
On Thu, 2019-04-18 at 14:38 +0000, Trond Myklebust wrote:
> Hi Scott,
>
> On Thu, 2019-04-18 at 09:37 -0400, Scott Mayhew wrote:
> > When the client does an open(CLAIM_FH) and the server already has
> > open
> > state for that open owner and file, what's supposed to happen?
> > Currently the server returns the existing stateid with the seqid
> > bumped,
> > but it looks like the client is expecting a new stateid (I'm seeing
> > the
> > state manager spending a lot of time waiting in
> > nfs_set_open_stateid_locked() due to NFS_STATE_CHANGE_WAIT being
> > set
> > in
> > the state flags by nfs_need_update_open_stateid()).
> >
> > Looking at rfc5661 section 18.16.3, I see:
> >
> > | CLAIM_NULL, CLAIM_FH | For the client, this is a new OPEN
> > request |
> > | | and there is no previous state
> > associated |
> > | | with the file for the
> > client. With |
> > | | CLAIM_NULL, the file is identified by
> > the |
> > | | current filehandle and the
> > specified |
> > | | component name. With CLAIM_FH (new
> > to |
> > | | NFSv4.1), the file is identified by
> > just |
> > | | the current filehandle.
> >
> > So it seems like maybe the server should be tossing the old state
> > and
> > returning a new stateid?
> >
>
> No. As far as the protocol is concerned, the only difference between
> CLAIM_NULL and CLAIM_FH is through how the client identifies the file
> (in the first case, through an implicit lookup, and in the second
> case
> through a file handle). The client should be free to intermix the two
> types of OPEN, and it should expect the resulting stateids to depend
> only on whether or not the open_owner matches. If the open_owner
> matches an existing stateid, then that stateid is bumped and
> returned.
>
> I'm not aware of any expectation in the client that this should not
> be
> the case, so if you are seeing different behaviour, then something
> else
> must be at work here. Is the client perhaps mounting the same
> filesystem in two different places in such a way that the super block
> is not being shared?
Oh, one thing to note that is both a protocol and a client expectation:
if the server returns multiple different filehandles for the same file
(i.e. same fsid:fileid combination), then the stateid is attached to
the _filehandle_ and not the fsid;fileid combination. So if the server
is coded to return a different filehandle in the CLAIM_NULL case than
the one used for CLAIM_FH, then that would explain the expectation
above.
This should never be the case for knfsd.
--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com
next prev parent reply other threads:[~2019-04-18 15:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-18 13:37 Question about open(CLAIM_FH) Scott Mayhew
2019-04-18 14:38 ` Trond Myklebust
2019-04-18 15:26 ` Trond Myklebust [this message]
2019-04-18 20:43 ` Scott Mayhew
2019-04-18 21:31 ` Trond Myklebust
2019-04-30 18:44 ` Scott Mayhew
2019-04-30 18:56 ` Trond Myklebust
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=2cb06c38ec956753eaf882dd30053f11532f5608.camel@hammerspace.com \
--to=trondmy@hammerspace.com \
--cc=linux-nfs@vger.kernel.org \
--cc=smayhew@redhat.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).