aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2021-09-26 14:05:04 -0400
committerTrond Myklebust <trond.myklebust@hammerspace.com>2021-10-03 20:49:06 -0400
commiteea413308f2e6deb00f061f18081a53f3ecc8cc6 (patch)
tree78c285736096636c1be78e6e709ef4c3b14713d9 /fs/nfs/inode.c
parentNFSv4: Retrieve ACCESS on open if we're not using NFS4_CREATE_EXCLUSIVE (diff)
downloadlinux-dev-eea413308f2e6deb00f061f18081a53f3ecc8cc6.tar.xz
linux-dev-eea413308f2e6deb00f061f18081a53f3ecc8cc6.zip
NFS: Default change_attr_type to NFS4_CHANGE_TYPE_IS_UNDEFINED
Both NFSv3 and NFSv2 generate their change attribute from the ctime value that was supplied by the server. However the problem is that there are plenty of servers out there with ctime resolutions of 1ms or worse. In a modern performance system, this is insufficient when trying to decide which is the most recent set of attributes when, for instance, a READ or GETATTR call races with a WRITE or SETATTR. For this reason, let's revert to labelling the NFSv2/v3 change attributes as NFS4_CHANGE_TYPE_IS_UNDEFINED. This will ensure we protect against such races. Fixes: 7b24dacf0840 ("NFS: Another inode revalidation improvement") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Tested-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 4f45281c47cf..0f092ccb0ca1 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1777,8 +1777,10 @@ static int nfs_inode_finish_partial_attr_update(const struct nfs_fattr *fattr,
NFS_INO_INVALID_BLOCKS | NFS_INO_INVALID_OTHER |
NFS_INO_INVALID_NLINK;
unsigned long cache_validity = NFS_I(inode)->cache_validity;
+ enum nfs4_change_attr_type ctype = NFS_SERVER(inode)->change_attr_type;
- if (!(cache_validity & NFS_INO_INVALID_CHANGE) &&
+ if (ctype != NFS4_CHANGE_TYPE_IS_UNDEFINED &&
+ !(cache_validity & NFS_INO_INVALID_CHANGE) &&
(cache_validity & check_valid) != 0 &&
(fattr->valid & NFS_ATTR_FATTR_CHANGE) != 0 &&
nfs_inode_attrs_cmp_monotonic(fattr, inode) == 0)