+++ /dev/null
-From b46ff3921099cb7a9a905a772cc0896c64932e98 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 25 Mar 2021 21:20:32 -0400
-Subject: NFS: Don't set NFS_INO_REVAL_PAGECACHE in the inode cache validity
-
-From: Trond Myklebust <trond.myklebust@hammerspace.com>
-
-[ Upstream commit 36a9346c225270262d9f34e66c91aa1723fa903f ]
-
-It is no longer necessary to preserve the NFS_INO_REVAL_PAGECACHE flag.
-
-Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/nfs/inode.c | 6 ++----
- fs/nfs/nfs4proc.c | 1 -
- 2 files changed, 2 insertions(+), 5 deletions(-)
-
-diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
-index 1d2c1add7b7a2..0fdc7cf994a0f 100644
---- a/fs/nfs/inode.c
-+++ b/fs/nfs/inode.c
-@@ -217,11 +217,12 @@ static void nfs_set_cache_invalid(struct inode *inode, unsigned long flags)
- flags &= ~NFS_INO_INVALID_OTHER;
- flags &= ~(NFS_INO_INVALID_CHANGE
- | NFS_INO_INVALID_SIZE
-- | NFS_INO_REVAL_PAGECACHE
- | NFS_INO_INVALID_XATTR);
- } else if (flags & NFS_INO_REVAL_PAGECACHE)
- flags |= NFS_INO_INVALID_CHANGE | NFS_INO_INVALID_SIZE;
-
-+ flags &= ~NFS_INO_REVAL_PAGECACHE;
-+
- if (!nfs_has_xattr_cache(nfsi))
- flags &= ~NFS_INO_INVALID_XATTR;
- if (inode->i_mapping->nrpages == 0)
-@@ -1904,7 +1905,6 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
- nfsi->cache_validity &= ~(NFS_INO_INVALID_ATTR
- | NFS_INO_INVALID_ATIME
- | NFS_INO_REVAL_FORCED
-- | NFS_INO_REVAL_PAGECACHE
- | NFS_INO_INVALID_BLOCKS);
-
- /* Do atomic weak cache consistency updates */
-@@ -1942,7 +1942,6 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
- } else {
- nfsi->cache_validity |= save_cache_validity &
- (NFS_INO_INVALID_CHANGE
-- | NFS_INO_REVAL_PAGECACHE
- | NFS_INO_REVAL_FORCED);
- cache_revalidated = false;
- }
-@@ -1988,7 +1987,6 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
- } else {
- nfsi->cache_validity |= save_cache_validity &
- (NFS_INO_INVALID_SIZE
-- | NFS_INO_REVAL_PAGECACHE
- | NFS_INO_REVAL_FORCED);
- cache_revalidated = false;
- }
-diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
-index 916513c3be8d5..48ed61e5ac0f3 100644
---- a/fs/nfs/nfs4proc.c
-+++ b/fs/nfs/nfs4proc.c
-@@ -1197,7 +1197,6 @@ nfs4_update_changeattr_locked(struct inode *inode,
- cache_validity |= NFS_INO_INVALID_CTIME | NFS_INO_INVALID_MTIME;
-
- if (cinfo->atomic && cinfo->before == inode_peek_iversion_raw(inode)) {
-- nfsi->cache_validity &= ~NFS_INO_REVAL_PAGECACHE;
- nfsi->attrtimeo_timestamp = jiffies;
- } else {
- if (S_ISDIR(inode->i_mode)) {
---
-2.34.1
-
+++ /dev/null
-From 1794fa7a1a33cc24c9402dce84f7a59fd38d5707 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 8 Mar 2021 14:42:55 -0500
-Subject: NFS: Fix open coded versions of nfs_set_cache_invalid() in NFSv4
-
-From: Trond Myklebust <trond.myklebust@hammerspace.com>
-
-[ Upstream commit b6f80a2ebb97f184c4679518ac83074598bf9bf4 ]
-
-nfs_set_cache_invalid() has code to handle delegations, and other
-optimisations, so let's use it when appropriate.
-
-Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
-Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/nfs/inode.c | 1 +
- fs/nfs/nfs42proc.c | 12 +++++++-----
- fs/nfs/nfs4proc.c | 28 ++++++++++++----------------
- 3 files changed, 20 insertions(+), 21 deletions(-)
-
-diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
-index 6e7fd73a264af..1d2c1add7b7a2 100644
---- a/fs/nfs/inode.c
-+++ b/fs/nfs/inode.c
-@@ -230,6 +230,7 @@ static void nfs_set_cache_invalid(struct inode *inode, unsigned long flags)
- if (flags & NFS_INO_INVALID_DATA)
- nfs_fscache_invalidate(inode);
- }
-+EXPORT_SYMBOL_GPL(nfs_set_cache_invalid);
-
- /*
- * Invalidate the local caches
-diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
-index 2587b1b8e2ef7..0bebfb3ec3b68 100644
---- a/fs/nfs/nfs42proc.c
-+++ b/fs/nfs/nfs42proc.c
-@@ -366,13 +366,15 @@ static ssize_t _nfs42_proc_copy(struct file *src,
- pos_dst >> PAGE_SHIFT,
- (pos_dst + res->write_res.count - 1) >> PAGE_SHIFT));
- spin_lock(&dst_inode->i_lock);
-- NFS_I(dst_inode)->cache_validity |= (NFS_INO_REVAL_PAGECACHE |
-- NFS_INO_REVAL_FORCED | NFS_INO_INVALID_SIZE |
-- NFS_INO_INVALID_ATTR | NFS_INO_INVALID_DATA);
-+ nfs_set_cache_invalid(
-+ dst_inode, NFS_INO_REVAL_PAGECACHE | NFS_INO_REVAL_FORCED |
-+ NFS_INO_INVALID_SIZE | NFS_INO_INVALID_ATTR |
-+ NFS_INO_INVALID_DATA);
- spin_unlock(&dst_inode->i_lock);
- spin_lock(&src_inode->i_lock);
-- NFS_I(src_inode)->cache_validity |= (NFS_INO_REVAL_PAGECACHE |
-- NFS_INO_REVAL_FORCED | NFS_INO_INVALID_ATIME);
-+ nfs_set_cache_invalid(src_inode, NFS_INO_REVAL_PAGECACHE |
-+ NFS_INO_REVAL_FORCED |
-+ NFS_INO_INVALID_ATIME);
- spin_unlock(&src_inode->i_lock);
- status = res->write_res.count;
- out:
-diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
-index d222a980164b7..916513c3be8d5 100644
---- a/fs/nfs/nfs4proc.c
-+++ b/fs/nfs/nfs4proc.c
-@@ -1176,14 +1176,14 @@ int nfs4_call_sync(struct rpc_clnt *clnt,
- static void
- nfs4_inc_nlink_locked(struct inode *inode)
- {
-- NFS_I(inode)->cache_validity |= NFS_INO_INVALID_OTHER;
-+ nfs_set_cache_invalid(inode, NFS_INO_INVALID_OTHER);
- inc_nlink(inode);
- }
-
- static void
- nfs4_dec_nlink_locked(struct inode *inode)
- {
-- NFS_I(inode)->cache_validity |= NFS_INO_INVALID_OTHER;
-+ nfs_set_cache_invalid(inode, NFS_INO_INVALID_OTHER);
- drop_nlink(inode);
- }
-
-@@ -1194,35 +1194,31 @@ nfs4_update_changeattr_locked(struct inode *inode,
- {
- struct nfs_inode *nfsi = NFS_I(inode);
-
-- nfsi->cache_validity |= NFS_INO_INVALID_CTIME
-- | NFS_INO_INVALID_MTIME
-- | cache_validity;
-+ cache_validity |= NFS_INO_INVALID_CTIME | NFS_INO_INVALID_MTIME;
-
- if (cinfo->atomic && cinfo->before == inode_peek_iversion_raw(inode)) {
- nfsi->cache_validity &= ~NFS_INO_REVAL_PAGECACHE;
- nfsi->attrtimeo_timestamp = jiffies;
- } else {
- if (S_ISDIR(inode->i_mode)) {
-- nfsi->cache_validity |= NFS_INO_INVALID_DATA;
-+ cache_validity |= NFS_INO_INVALID_DATA;
- nfs_force_lookup_revalidate(inode);
- } else {
- if (!NFS_PROTO(inode)->have_delegation(inode,
- FMODE_READ))
-- nfsi->cache_validity |= NFS_INO_REVAL_PAGECACHE;
-+ cache_validity |= NFS_INO_REVAL_PAGECACHE;
- }
-
- if (cinfo->before != inode_peek_iversion_raw(inode))
-- nfsi->cache_validity |= NFS_INO_INVALID_ACCESS |
-- NFS_INO_INVALID_ACL |
-- NFS_INO_INVALID_XATTR;
-+ cache_validity |= NFS_INO_INVALID_ACCESS |
-+ NFS_INO_INVALID_ACL |
-+ NFS_INO_INVALID_XATTR;
- }
- inode_set_iversion_raw(inode, cinfo->after);
- nfsi->read_cache_jiffies = timestamp;
- nfsi->attr_gencount = nfs_inc_attr_generation_counter();
-+ nfs_set_cache_invalid(inode, cache_validity);
- nfsi->cache_validity &= ~NFS_INO_INVALID_CHANGE;
--
-- if (nfsi->cache_validity & NFS_INO_INVALID_DATA)
-- nfs_fscache_invalidate(inode);
- }
-
- void
-@@ -5931,9 +5927,9 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl
- * so mark the attribute cache invalid.
- */
- spin_lock(&inode->i_lock);
-- NFS_I(inode)->cache_validity |= NFS_INO_INVALID_CHANGE
-- | NFS_INO_INVALID_CTIME
-- | NFS_INO_REVAL_FORCED;
-+ nfs_set_cache_invalid(inode, NFS_INO_INVALID_CHANGE |
-+ NFS_INO_INVALID_CTIME |
-+ NFS_INO_REVAL_FORCED);
- spin_unlock(&inode->i_lock);
- nfs_access_zap_cache(inode);
- nfs_zap_acl_cache(inode);
---
-2.34.1
-
+++ /dev/null
-From 0926c5769c40461d69d9d3d1507b793ed9e62b5b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 8 Feb 2022 12:14:44 -0500
-Subject: NFS: Remove an incorrect revalidation in
- nfs4_update_changeattr_locked()
-
-From: Trond Myklebust <trond.myklebust@hammerspace.com>
-
-[ Upstream commit 9d047bf68fe8cdb4086deaf4edd119731a9481ed ]
-
-In nfs4_update_changeattr_locked(), we don't need to set the
-NFS_INO_REVAL_PAGECACHE flag, because we already know the value of the
-change attribute, and we're already flagging the size. In fact, this
-forces us to revalidate the change attribute a second time for no good
-reason.
-This extra flag appears to have been introduced as part of the xattr
-feature, when update_changeattr_locked() was converted for use by the
-xattr code.
-
-Fixes: 1b523ca972ed ("nfs: modify update_changeattr to deal with regular files")
-Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
-Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/nfs/nfs4proc.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
-index 4c80369e0a837..1e91643970a46 100644
---- a/fs/nfs/nfs4proc.c
-+++ b/fs/nfs/nfs4proc.c
-@@ -1219,8 +1219,7 @@ nfs4_update_changeattr_locked(struct inode *inode,
- NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL |
- NFS_INO_INVALID_SIZE | NFS_INO_INVALID_OTHER |
- NFS_INO_INVALID_BLOCKS | NFS_INO_INVALID_NLINK |
-- NFS_INO_INVALID_MODE | NFS_INO_INVALID_XATTR |
-- NFS_INO_REVAL_PAGECACHE;
-+ NFS_INO_INVALID_MODE | NFS_INO_INVALID_XATTR;
- nfsi->attrtimeo = NFS_MINATTRTIMEO(inode);
- }
- nfsi->attrtimeo_timestamp = jiffies;
---
-2.34.1
-
+++ /dev/null
-From bd3871990f502faaa518e3683258db2e8c703ad2 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 26 Mar 2021 11:01:19 -0400
-Subject: NFS: Use information about the change attribute to optimise updates
-
-From: Trond Myklebust <trond.myklebust@hammerspace.com>
-
-[ Upstream commit 6f9be83d07615e6af8838a1d489080b399f42a08 ]
-
-If the NFSv4.2 server supports the 'change_attr_type' attribute, then
-allow the client to optimise its attribute cache update strategy.
-
-Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/nfs/inode.c | 111 ++++++++++++++++++++++++++++++++++++++--------
- fs/nfs/nfs4proc.c | 20 +++++++--
- 2 files changed, 110 insertions(+), 21 deletions(-)
-
-diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
-index 0fdc7cf994a0f..f7929988b83bb 100644
---- a/fs/nfs/inode.c
-+++ b/fs/nfs/inode.c
-@@ -1643,25 +1643,20 @@ EXPORT_SYMBOL_GPL(_nfs_display_fhandle);
- #endif
-
- /**
-- * nfs_inode_attrs_need_update - check if the inode attributes need updating
-- * @inode: pointer to inode
-+ * nfs_inode_attrs_cmp_generic - compare attributes
- * @fattr: attributes
-+ * @inode: pointer to inode
- *
- * Attempt to divine whether or not an RPC call reply carrying stale
- * attributes got scheduled after another call carrying updated ones.
-- *
-- * To do so, the function first assumes that a more recent ctime means
-- * that the attributes in fattr are newer, however it also attempt to
-- * catch the case where ctime either didn't change, or went backwards
-- * (if someone reset the clock on the server) by looking at whether
-- * or not this RPC call was started after the inode was last updated.
- * Note also the check for wraparound of 'attr_gencount'
- *
-- * The function returns 'true' if it thinks the attributes in 'fattr' are
-- * more recent than the ones cached in the inode.
-- *
-+ * The function returns '1' if it thinks the attributes in @fattr are
-+ * more recent than the ones cached in @inode. Otherwise it returns
-+ * the value '0'.
- */
--static int nfs_inode_attrs_need_update(const struct inode *inode, const struct nfs_fattr *fattr)
-+static int nfs_inode_attrs_cmp_generic(const struct nfs_fattr *fattr,
-+ const struct inode *inode)
- {
- unsigned long attr_gencount = NFS_I(inode)->attr_gencount;
-
-@@ -1669,15 +1664,93 @@ static int nfs_inode_attrs_need_update(const struct inode *inode, const struct n
- (long)(attr_gencount - nfs_read_attr_generation_counter()) > 0;
- }
-
--static int nfs_refresh_inode_locked(struct inode *inode, struct nfs_fattr *fattr)
-+/**
-+ * nfs_inode_attrs_cmp_monotonic - compare attributes
-+ * @fattr: attributes
-+ * @inode: pointer to inode
-+ *
-+ * Attempt to divine whether or not an RPC call reply carrying stale
-+ * attributes got scheduled after another call carrying updated ones.
-+ *
-+ * We assume that the server observes monotonic semantics for
-+ * the change attribute, so a larger value means that the attributes in
-+ * @fattr are more recent, in which case the function returns the
-+ * value '1'.
-+ * A return value of '0' indicates no measurable change
-+ * A return value of '-1' means that the attributes in @inode are
-+ * more recent.
-+ */
-+static int nfs_inode_attrs_cmp_monotonic(const struct nfs_fattr *fattr,
-+ const struct inode *inode)
- {
-- int ret;
-+ s64 diff = fattr->change_attr - inode_peek_iversion_raw(inode);
-+ if (diff > 0)
-+ return 1;
-+ return diff == 0 ? 0 : -1;
-+}
-+
-+/**
-+ * nfs_inode_attrs_cmp_strict_monotonic - compare attributes
-+ * @fattr: attributes
-+ * @inode: pointer to inode
-+ *
-+ * Attempt to divine whether or not an RPC call reply carrying stale
-+ * attributes got scheduled after another call carrying updated ones.
-+ *
-+ * We assume that the server observes strictly monotonic semantics for
-+ * the change attribute, so a larger value means that the attributes in
-+ * @fattr are more recent, in which case the function returns the
-+ * value '1'.
-+ * A return value of '-1' means that the attributes in @inode are
-+ * more recent or unchanged.
-+ */
-+static int nfs_inode_attrs_cmp_strict_monotonic(const struct nfs_fattr *fattr,
-+ const struct inode *inode)
-+{
-+ return nfs_inode_attrs_cmp_monotonic(fattr, inode) > 0 ? 1 : -1;
-+}
-+
-+/**
-+ * nfs_inode_attrs_cmp - compare attributes
-+ * @fattr: attributes
-+ * @inode: pointer to inode
-+ *
-+ * This function returns '1' if it thinks the attributes in @fattr are
-+ * more recent than the ones cached in @inode. It returns '-1' if
-+ * the attributes in @inode are more recent than the ones in @fattr,
-+ * and it returns 0 if not sure.
-+ */
-+static int nfs_inode_attrs_cmp(const struct nfs_fattr *fattr,
-+ const struct inode *inode)
-+{
-+ if (nfs_inode_attrs_cmp_generic(fattr, inode) > 0)
-+ return 1;
-+ switch (NFS_SERVER(inode)->change_attr_type) {
-+ case NFS4_CHANGE_TYPE_IS_UNDEFINED:
-+ break;
-+ case NFS4_CHANGE_TYPE_IS_TIME_METADATA:
-+ if (!(fattr->valid & NFS_ATTR_FATTR_CHANGE))
-+ break;
-+ return nfs_inode_attrs_cmp_monotonic(fattr, inode);
-+ default:
-+ if (!(fattr->valid & NFS_ATTR_FATTR_CHANGE))
-+ break;
-+ return nfs_inode_attrs_cmp_strict_monotonic(fattr, inode);
-+ }
-+ return 0;
-+}
-+
-+static int nfs_refresh_inode_locked(struct inode *inode,
-+ struct nfs_fattr *fattr)
-+{
-+ int attr_cmp = nfs_inode_attrs_cmp(fattr, inode);
-+ int ret = 0;
-
- trace_nfs_refresh_inode_enter(inode);
-
-- if (nfs_inode_attrs_need_update(inode, fattr))
-+ if (attr_cmp > 0)
- ret = nfs_update_inode(inode, fattr);
-- else
-+ else if (attr_cmp == 0)
- ret = nfs_check_inode_attributes(inode, fattr);
-
- trace_nfs_refresh_inode_exit(inode, ret);
-@@ -1762,11 +1835,13 @@ EXPORT_SYMBOL_GPL(nfs_post_op_update_inode);
- */
- int nfs_post_op_update_inode_force_wcc_locked(struct inode *inode, struct nfs_fattr *fattr)
- {
-+ int attr_cmp = nfs_inode_attrs_cmp(fattr, inode);
- int status;
-
- /* Don't do a WCC update if these attributes are already stale */
-- if ((fattr->valid & NFS_ATTR_FATTR) == 0 ||
-- !nfs_inode_attrs_need_update(inode, fattr)) {
-+ if (attr_cmp < 0)
-+ return 0;
-+ if ((fattr->valid & NFS_ATTR_FATTR) == 0 || !attr_cmp) {
- fattr->valid &= ~(NFS_ATTR_FATTR_PRECHANGE
- | NFS_ATTR_FATTR_PRESIZE
- | NFS_ATTR_FATTR_PREMTIME
-diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
-index 48ed61e5ac0f3..eda7d7fc84ad0 100644
---- a/fs/nfs/nfs4proc.c
-+++ b/fs/nfs/nfs4proc.c
-@@ -1193,10 +1193,23 @@ nfs4_update_changeattr_locked(struct inode *inode,
- unsigned long timestamp, unsigned long cache_validity)
- {
- struct nfs_inode *nfsi = NFS_I(inode);
-+ u64 change_attr = inode_peek_iversion_raw(inode);
-
- cache_validity |= NFS_INO_INVALID_CTIME | NFS_INO_INVALID_MTIME;
-
-- if (cinfo->atomic && cinfo->before == inode_peek_iversion_raw(inode)) {
-+ switch (NFS_SERVER(inode)->change_attr_type) {
-+ case NFS4_CHANGE_TYPE_IS_UNDEFINED:
-+ break;
-+ case NFS4_CHANGE_TYPE_IS_TIME_METADATA:
-+ if ((s64)(change_attr - cinfo->after) > 0)
-+ goto out;
-+ break;
-+ default:
-+ if ((s64)(change_attr - cinfo->after) >= 0)
-+ goto out;
-+ }
-+
-+ if (cinfo->atomic && cinfo->before == change_attr) {
- nfsi->attrtimeo_timestamp = jiffies;
- } else {
- if (S_ISDIR(inode->i_mode)) {
-@@ -1208,7 +1221,7 @@ nfs4_update_changeattr_locked(struct inode *inode,
- cache_validity |= NFS_INO_REVAL_PAGECACHE;
- }
-
-- if (cinfo->before != inode_peek_iversion_raw(inode))
-+ if (cinfo->before != change_attr)
- cache_validity |= NFS_INO_INVALID_ACCESS |
- NFS_INO_INVALID_ACL |
- NFS_INO_INVALID_XATTR;
-@@ -1216,8 +1229,9 @@ nfs4_update_changeattr_locked(struct inode *inode,
- inode_set_iversion_raw(inode, cinfo->after);
- nfsi->read_cache_jiffies = timestamp;
- nfsi->attr_gencount = nfs_inc_attr_generation_counter();
-- nfs_set_cache_invalid(inode, cache_validity);
- nfsi->cache_validity &= ~NFS_INO_INVALID_CHANGE;
-+out:
-+ nfs_set_cache_invalid(inode, cache_validity);
- }
-
- void
---
-2.34.1
-
+++ /dev/null
-From 9885d62e392ac7eebd6bf99a30ba00278abf54f9 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 25 Jun 2021 15:49:31 -0400
-Subject: NFSv4: Fix handling of non-atomic change attrbute updates
-
-From: Trond Myklebust <trond.myklebust@hammerspace.com>
-
-[ Upstream commit 20cf7d4ea4ad7d9830b01ff7444f6ac64a727a23 ]
-
-If the change attribute update is declared to be non-atomic by the
-server, or our cached value does not match the server's value before the
-operation was performed, then we should declare the inode cache invalid.
-
-On the other hand, if the change to the directory raced with a lookup or
-getattr which already updated the change attribute, then optimise away
-the revalidation.
-
-Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/nfs/nfs4proc.c | 33 +++++++++++++++------------------
- 1 file changed, 15 insertions(+), 18 deletions(-)
-
-diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
-index eda7d7fc84ad0..4c80369e0a837 100644
---- a/fs/nfs/nfs4proc.c
-+++ b/fs/nfs/nfs4proc.c
-@@ -1196,12 +1196,12 @@ nfs4_update_changeattr_locked(struct inode *inode,
- u64 change_attr = inode_peek_iversion_raw(inode);
-
- cache_validity |= NFS_INO_INVALID_CTIME | NFS_INO_INVALID_MTIME;
-+ if (S_ISDIR(inode->i_mode))
-+ cache_validity |= NFS_INO_INVALID_DATA;
-
- switch (NFS_SERVER(inode)->change_attr_type) {
- case NFS4_CHANGE_TYPE_IS_UNDEFINED:
-- break;
-- case NFS4_CHANGE_TYPE_IS_TIME_METADATA:
-- if ((s64)(change_attr - cinfo->after) > 0)
-+ if (cinfo->after == change_attr)
- goto out;
- break;
- default:
-@@ -1209,24 +1209,21 @@ nfs4_update_changeattr_locked(struct inode *inode,
- goto out;
- }
-
-- if (cinfo->atomic && cinfo->before == change_attr) {
-- nfsi->attrtimeo_timestamp = jiffies;
-- } else {
-- if (S_ISDIR(inode->i_mode)) {
-- cache_validity |= NFS_INO_INVALID_DATA;
-+ inode_set_iversion_raw(inode, cinfo->after);
-+ if (!cinfo->atomic || cinfo->before != change_attr) {
-+ if (S_ISDIR(inode->i_mode))
- nfs_force_lookup_revalidate(inode);
-- } else {
-- if (!NFS_PROTO(inode)->have_delegation(inode,
-- FMODE_READ))
-- cache_validity |= NFS_INO_REVAL_PAGECACHE;
-- }
-
-- if (cinfo->before != change_attr)
-- cache_validity |= NFS_INO_INVALID_ACCESS |
-- NFS_INO_INVALID_ACL |
-- NFS_INO_INVALID_XATTR;
-+ if (!NFS_PROTO(inode)->have_delegation(inode, FMODE_READ))
-+ cache_validity |=
-+ NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL |
-+ NFS_INO_INVALID_SIZE | NFS_INO_INVALID_OTHER |
-+ NFS_INO_INVALID_BLOCKS | NFS_INO_INVALID_NLINK |
-+ NFS_INO_INVALID_MODE | NFS_INO_INVALID_XATTR |
-+ NFS_INO_REVAL_PAGECACHE;
-+ nfsi->attrtimeo = NFS_MINATTRTIMEO(inode);
- }
-- inode_set_iversion_raw(inode, cinfo->after);
-+ nfsi->attrtimeo_timestamp = jiffies;
- nfsi->read_cache_jiffies = timestamp;
- nfsi->attr_gencount = nfs_inc_attr_generation_counter();
- nfsi->cache_validity &= ~NFS_INO_INVALID_CHANGE;
---
-2.34.1
-
kvm-x86-pmu-don-t-truncate-the-perfevtseln-msr-when-.patch
kvm-x86-pmu-use-amd64_raw_event_mask-for-perf_type_r.patch
nfs-don-t-set-nfs_ino_invalid_xattr-if-there-is-no-x.patch
-nfs-fix-open-coded-versions-of-nfs_set_cache_invalid.patch
-nfs-don-t-set-nfs_ino_reval_pagecache-in-the-inode-c.patch
-nfs-use-information-about-the-change-attribute-to-op.patch
-nfsv4-fix-handling-of-non-atomic-change-attrbute-upd.patch
-nfs-remove-an-incorrect-revalidation-in-nfs4_update_.patch
nfs-lookup_directory-is-also-ok-with-symlinks.patch
tty-n_tty-do-not-look-ahead-for-eol-character-past-t.patch
nfs-do-not-report-writeback-errors-in-nfs_getattr.patch