From: NeilBrown <neilb@suse.de>
To: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: Jeff Layton <jlayton@poochiereds.net>,
"Mkrtchyan, Tigran" <tigran.mkrtchyan@desy.de>,
Jim Rees <rees@umich.edu>, linux-nfs <linux-nfs@vger.kernel.org>
Subject: Re: readdir vs. getattr
Date: Fri, 7 Feb 2014 15:30:28 +1100 [thread overview]
Message-ID: <20140207153028.7df0d209@notabene.brown> (raw)
In-Reply-To: <1391724779.6399.2.camel@leira.trondhjem.org>
[-- Attachment #1: Type: text/plain, Size: 3713 bytes --]
On Thu, 06 Feb 2014 17:12:59 -0500 Trond Myklebust
<trond.myklebust@primarydata.com> wrote:
> On Thu, 2014-02-06 at 13:51 +1100, NeilBrown wrote:
> > On Thu, 6 Feb 2014 13:45:39 +1100 NeilBrown <neilb@suse.de> wrote:
> >
> >
> > > The change to nfs_update_inode fixes an issue that had me stumped for a
> > > while. It was still sending lots of GETATTR requests even after it had
> > > switched to READDIRPLUS instead of using cached info. So that might be a
> > > genuine bug that should be fixed independently of this patch.
> >
> > I managed to post the wrong version of the patch, which didn't have this
> > change. Sorry.
> >
> > Here is the real one.
> >
> > NeilBrown
>
> Hi Neil,
>
> Is there any reason why this patch couldn't just be replaced with the
> following?
Well.... the following doesn't make any change in my test case. :-(
In my test case there is a large directory on the server which doesn't change.
The client sends lots of requests to see if it has changed, but it hasn't.
(Tested with the labeled-NFS-regression fix applied)
Your patch only changes behaviour if nfs_force_lookup_revalidate is called,
and that is only called when NFS_ATTR_FATTR_CHANGE is set, or when an NFSv4
client modifies the directory. Neither of those are happening.
Thanks,
NeilBrown
> (Please note the separate fix for the labeled NFS regression that you
> pointed out.)
>
> Cheers
> Trond
>
> 8<-------------------------------------------------------------------
> >From fda6d0fb7988fd7d541ef6d1023bca92b0e10333 Mon Sep 17 00:00:00 2001
> From: Trond Myklebust <trond.myklebust@primarydata.com>
> Date: Thu, 6 Feb 2014 16:45:21 -0500
> Subject: [PATCH] NFS: Use readdirplus in order to efficiently revalidate whole
> directories
>
> When we call nfs_force_lookup_revalidate() in order to force a full
> lookup of all child dentries of a directory, it makes sense to use
> readdirplus to perform that revalidation as efficiently as possible.
>
> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
> ---
> fs/nfs/dir.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
> index be38b573495a..2abcae330ad0 100644
> --- a/fs/nfs/dir.c
> +++ b/fs/nfs/dir.c
> @@ -437,6 +437,24 @@ void nfs_advise_use_readdirplus(struct inode *dir)
> set_bit(NFS_INO_ADVISE_RDPLUS, &NFS_I(dir)->flags);
> }
>
> +/*
> + * Force use of readdirplus to ensure efficient revalidation of
> + * the directory child dentries when we know that we will need
> + * to revalidate the whole directory.
> + *
> + * Caller must hold dir->i_lock.
> + */
> +static
> +void nfs_force_use_readdirplus(struct inode *dir)
> +{
> + if (nfs_server_capable(dir, NFS_CAP_READDIRPLUS)) {
> + struct nfs_inode *nfsi = NFS_I(dir);
> +
> + set_bit(NFS_INO_ADVISE_RDPLUS, &nfsi->flags);
> + nfsi->cache_validity |= NFS_INO_INVALID_DATA;
> + }
> +}
> +
> static
> void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry)
> {
> @@ -942,12 +960,14 @@ static int nfs_fsync_dir(struct file *filp, loff_t start, loff_t end,
> * This forces the revalidation code in nfs_lookup_revalidate() to do a
> * full lookup on all child dentries of 'dir' whenever a change occurs
> * on the server that might have invalidated our dcache.
> + * Call nfs_force_use_readdirplus for efficiency.
> *
> * The caller should be holding dir->i_lock
> */
> void nfs_force_lookup_revalidate(struct inode *dir)
> {
> NFS_I(dir)->cache_change_attribute++;
> + nfs_force_use_readdirplus(dir);
> }
> EXPORT_SYMBOL_GPL(nfs_force_lookup_revalidate);
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next prev parent reply other threads:[~2014-02-07 4:30 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-04 14:47 readdir vs. getattr Tigran Mkrtchyan
2013-04-04 15:15 ` Jim Rees
2013-04-04 15:32 ` Chuck Lever
2013-04-04 16:01 ` Jim Rees
2013-04-04 16:15 ` Myklebust, Trond
2013-04-04 16:35 ` Jim Rees
2013-04-04 18:28 ` Tigran Mkrtchyan
2013-04-04 15:38 ` Tigran Mkrtchyan
2013-04-04 15:48 ` Myklebust, Trond
2013-04-04 15:52 ` Tigran Mkrtchyan
2014-01-29 7:10 ` NeilBrown
2014-01-29 7:25 ` NeilBrown
2014-01-29 9:21 ` Mkrtchyan, Tigran
2014-01-29 12:18 ` Jeff Layton
2014-02-06 2:45 ` NeilBrown
2014-02-06 2:51 ` NeilBrown
2014-02-06 18:08 ` Jeff Layton
2014-02-06 19:53 ` [PATCH] NFS: Do not set NFS_INO_INVALID_LABEL unless server supports labeled NFS Trond Myklebust
2014-02-07 4:21 ` NeilBrown
2014-02-06 22:12 ` readdir vs. getattr Trond Myklebust
2014-02-07 4:30 ` NeilBrown [this message]
2014-02-07 19:47 ` Trond Myklebust
2014-02-07 22:08 ` Trond Myklebust
2014-02-10 0:16 ` NeilBrown
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=20140207153028.7df0d209@notabene.brown \
--to=neilb@suse.de \
--cc=jlayton@poochiereds.net \
--cc=linux-nfs@vger.kernel.org \
--cc=rees@umich.edu \
--cc=tigran.mkrtchyan@desy.de \
--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