2021-03-30 00:21:06

by Trond Myklebust

[permalink] [raw]
Subject: [PATCH 12/17] NFS: Fix up handling of outstanding layoutcommit in nfs_update_inode()

From: Trond Myklebust <[email protected]>

If there is an outstanding layoutcommit, then the list of attributes
whose values are expected to change is not the full set. So let's
be explicit about the full list.

Signed-off-by: Trond Myklebust <[email protected]>
---
fs/nfs/inode.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index c9386981d210..e57cd490bc4d 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1939,7 +1939,11 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
nfs_wcc_update_inode(inode, fattr);

if (pnfs_layoutcommit_outstanding(inode)) {
- nfsi->cache_validity |= save_cache_validity & NFS_INO_INVALID_ATTR;
+ nfsi->cache_validity |=
+ save_cache_validity &
+ (NFS_INO_INVALID_CHANGE | NFS_INO_INVALID_CTIME |
+ NFS_INO_INVALID_MTIME | NFS_INO_INVALID_SIZE |
+ NFS_INO_REVAL_FORCED);
cache_revalidated = false;
}

--
2.30.2


2021-03-30 00:21:46

by Trond Myklebust

[permalink] [raw]
Subject: [PATCH 13/17] NFS: Remove a line of code that has no effect in nfs_update_inode()

From: Trond Myklebust <[email protected]>

Commit 0b467264d0db ("NFS: Fix attribute revalidation") changed the way
we populate the 'invalid' attribute, and made the line that strips away
the NFS_INO_INVALID_ATTR bits redundant.

Signed-off-by: Trond Myklebust <[email protected]>
---
fs/nfs/inode.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index e57cd490bc4d..f60dc562e84b 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -2115,7 +2115,6 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)

/* Update attrtimeo value if we're out of the unstable period */
if (attr_changed) {
- invalid &= ~NFS_INO_INVALID_ATTR;
nfs_inc_stats(inode, NFSIOS_ATTRINVALIDATE);
nfsi->attrtimeo = NFS_MINATTRTIMEO(inode);
nfsi->attrtimeo_timestamp = now;
--
2.30.2