From: Trond Myklebust <trondmy@hammerspace.com>
To: "bcodding@redhat.com" <bcodding@redhat.com>
Cc: "linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
"anna.schumaker@netapp.com" <anna.schumaker@netapp.com>
Subject: Re: client skips revalidation if holding a delegation
Date: Tue, 4 Jun 2019 14:53:42 +0000 [thread overview]
Message-ID: <a595b6962b2e083fef8ad2d3534e1d0964995560.camel@hammerspace.com> (raw)
In-Reply-To: <CFD3CE5E-5081-4A4D-B67E-41D9E7A3D5C5@redhat.com>
On Tue, 2019-06-04 at 10:10 -0400, Benjamin Coddington wrote:
> On 4 Jun 2019, at 8:56, Trond Myklebust wrote:
>
> > On Tue, 2019-06-04 at 08:41 -0400, Benjamin Coddington wrote:
> > > Hey linux-nfs, and especially maintainers,
> > >
> > > I'm still interested in working on a problem raised a couple
> > > weeks
> > > ago, but
> > > confusion muddled that discussion and it died:
> > >
> > > If the client holds a read delegation, it will skip revalidation
> > > of a
> > > dentry
> > > in lookup. If the file was moved on the server, the client can
> > > end
> > > up with
> > > two positive dentries in cache for the same inode, and the dentry
> > > that
> > > doesn't exist on the server will never time out of the cache.
> > >
> > > The client can detect this happening because the directory of the
> > > dentry
> > > that should be revalidated updates it's change
> > > attribute. Skipping
> > > revalidation is an optimization in the case we hold a delegation,
> > > but
> > > this
> > > optimization should only be used when the delegation was obtained
> > > via
> > > a
> > > lookup of the dentry we are currently revalidating.
> > >
> > > Keeping the optimization might be done by tying the delegation to
> > > the
> > > dentry. Lacking some (easy?) way to do that currently, it seems
> > > simpler to
> > > remove the optimization altogether, and I will send a patch to
> > > remove
> > > it.
> >
> > A delegation normally applies to the entire inode. It covers _all_
> > dentries that point to that inode too because create, rename and
> > unlink
> > are always atomically accompanied by an inode change attribute.
>
> It should cover all dentries that point to that inode at the time the
> delegation was handed out. Shouldn't dentries cached _before_ the
> delegation be invalidated? The client doesn't currently care about
> the
> order of dentries cached with respect to delegations.
>
> > IOW: The proposed restriction is both unnecessary and incorrect.
>
> But then I think: need to store that change attribute on the dentry
> instead
> of what we currently use - a client-only monotonic counter. Then, we
> could
> compare the delegation's change attr to the dentry's.
>
> But that assumes they are both globally related -- that a directory's
> change_attr on lookup relates to an inode's change attribute. I
> don't see
> that anywhere (I'm looking in 7530)..
>
OK. Now I think I see what you are saying. This would the case that is
of interest:
* A directory contains a file "foo", which has a hardlink "bar". Our
client has both link names cached due to a previous set of lookups.
* Some other client changes the name of "bar" to "barbar" on the
server.
* Our client then opens "foo" and gets a delegation.
* Our client is then asked to open "bar", and succeeds, failing to
recognise that it has been renamed to "barbar".
Is that what you mean? That looks like it might happen with the current
code, and would indeed be a bug.
Actually, in the NFSv4.1 open-by-filehandle case, we might even see a
bug when "foo" is renamed on the server too.
--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com
next prev parent reply other threads:[~2019-06-04 14:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-04 12:41 client skips revalidation if holding a delegation Benjamin Coddington
2019-06-04 12:56 ` Trond Myklebust
2019-06-04 14:10 ` Benjamin Coddington
2019-06-04 14:53 ` Trond Myklebust [this message]
2019-06-04 19:00 ` Benjamin Coddington
2019-06-10 14:14 ` Benjamin Coddington
2019-06-10 16:43 ` Trond Myklebust
2019-06-11 17:01 ` Benjamin Coddington
2019-06-10 17:08 ` Olga Kornievskaia
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=a595b6962b2e083fef8ad2d3534e1d0964995560.camel@hammerspace.com \
--to=trondmy@hammerspace.com \
--cc=anna.schumaker@netapp.com \
--cc=bcodding@redhat.com \
--cc=linux-nfs@vger.kernel.org \
/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