From: Trond Myklebust <trondmy@hammerspace.com>
To: "bcodding@redhat.com" <bcodding@redhat.com>,
"anna.schumaker@netapp.com" <anna.schumaker@netapp.com>
Cc: "linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH 2/3] NFSv42: Don't drop NFS_INO_INVALID_CHANGE if we hold a delegation
Date: Tue, 16 Nov 2021 14:03:32 +0000 [thread overview]
Message-ID: <a06d3d97a865747058c7d1cbcd4f70911c336fce.camel@hammerspace.com> (raw)
In-Reply-To: <c91e224b847e697e42b25cdc36cd164a61ad1ade.1637069577.git.bcodding@redhat.com>
On Tue, 2021-11-16 at 08:49 -0500, Benjamin Coddington wrote:
> The nfs_set_cache_invalid() helper drops NFS_INO_INVALID_CHANGE if we
> hold
> a delegation, but after a copy or clone the change attribute can be
> updated
> on the server. After commit b6f80a2ebb97 "NFS: Fix open coded
> versions of
> nfs_set_cache_invalid() in NFSv4", the client stopped updating the
> change
> attribute after copy or clone while holding a read delegation.
>
> We can use NFS_INO_REVAL_PAGECACHE to help nfs_set_cache_invalid()
> know
> when we really want to keep NFS_INO_INVALID_CHANGE, even if the
> client
> holds a delegation.
No, we really shouldn't need to care what the server thinks or does.
The client is authoritative for the change attribute while it holds a
delegation, not the server.
>
> Fixes: b6f80a2ebb97 ("NFS: Fix open coded versions of
> nfs_set_cache_invalid() in NFSv4")
> Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
> ---
> fs/nfs/inode.c | 4 +++-
> fs/nfs/nfs42proc.c | 3 ++-
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
> index 853213b3a209..296ed8ea3273 100644
> --- a/fs/nfs/inode.c
> +++ b/fs/nfs/inode.c
> @@ -202,7 +202,9 @@ void nfs_set_cache_invalid(struct inode *inode,
> unsigned long flags)
> flags &= ~(NFS_INO_INVALID_MODE |
> NFS_INO_INVALID_OTHER |
> NFS_INO_INVALID_XATTR);
> - flags &= ~(NFS_INO_INVALID_CHANGE |
> NFS_INO_INVALID_SIZE);
> + if (!(flags & NFS_INO_REVAL_PAGECACHE))
> + flags &= ~NFS_INO_INVALID_CHANGE;
> + flags &= ~NFS_INO_INVALID_SIZE;
> } else if (flags & NFS_INO_REVAL_PAGECACHE)
> flags |= NFS_INO_INVALID_CHANGE |
> NFS_INO_INVALID_SIZE;
>
> diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
> index bbcd4c80c5a6..fc3c36e1f656 100644
> --- a/fs/nfs/nfs42proc.c
> +++ b/fs/nfs/nfs42proc.c
> @@ -292,7 +292,8 @@ static void nfs42_copy_dest_done(struct inode
> *inode, loff_t pos, loff_t len)
> spin_lock(&inode->i_lock);
> if (newsize > i_size_read(inode))
> i_size_write(inode, newsize);
> - nfs_set_cache_invalid(inode, NFS_INO_INVALID_CHANGE |
> + nfs_set_cache_invalid(inode, NFS_INO_REVAL_PAGECACHE |
> + NFS_INO_INVALID_CHANGE |
> NFS_INO_INVALID_CTIME |
> NFS_INO_INVALID_MTIME |
> NFS_INO_INVALID_BLOCKS);
--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com
next prev parent reply other threads:[~2021-11-16 14:03 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-16 13:49 [PATCH 0/3] COPY/CLONE pagecache invalidation Benjamin Coddington
2021-11-16 13:49 ` [PATCH 1/3] NFSv42: Fix pagecache invalidation after COPY/CLONE Benjamin Coddington
2021-11-16 13:57 ` Trond Myklebust
2021-11-16 14:01 ` Benjamin Coddington
2021-11-16 14:06 ` Benjamin Coddington
2021-11-16 15:26 ` Trond Myklebust
2021-11-16 13:49 ` [PATCH 2/3] NFSv42: Don't drop NFS_INO_INVALID_CHANGE if we hold a delegation Benjamin Coddington
2021-11-16 14:03 ` Trond Myklebust [this message]
2021-11-16 14:12 ` Benjamin Coddington
2021-11-16 14:17 ` Trond Myklebust
2021-11-16 14:34 ` Benjamin Coddington
2021-11-16 14:49 ` Trond Myklebust
2021-11-16 15:15 ` Benjamin Coddington
2021-11-16 13:49 ` [PATCH 3/3] NFS: Add a tracepoint to show the results of nfs_set_cache_invalid() Benjamin Coddington
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=a06d3d97a865747058c7d1cbcd4f70911c336fce.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