NFS: Default change_attr_type to NFS4_CHANGE_TYPE_IS_UNDEFINED
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Sun, 26 Sep 2021 18:05:04 +0000 (14:05 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:16:59 +0000 (19:16 +0100)
commit7e2801edf23f04779abd88d5b5fa1d7e5f4e1e6c
tree863638a26f2ca10e50b35eb47a92d13e5d16311a
parent47dbabb8279c5b5e7025dae58d6d0bb8d6a75b72
NFS: Default change_attr_type to NFS4_CHANGE_TYPE_IS_UNDEFINED

[ Upstream commit eea413308f2e6deb00f061f18081a53f3ecc8cc6 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/inode.c
fs/nfs/nfs3xdr.c
fs/nfs/proc.c