nfsd: use the getattr operation to fetch i_version
authorJeff Layton <jlayton@kernel.org>
Wed, 7 Sep 2022 18:45:01 +0000 (14:45 -0400)
committerJeff Layton <jlayton@kernel.org>
Thu, 26 Jan 2023 12:00:06 +0000 (07:00 -0500)
commit638e3e7d9493dadca16cac7ea66e7cf368d4065a
treef44218cb65a1f9147c0b17cd2065b6acad074111
parent3139b1d79588f65977b3543149df01063dc3d323
nfsd: use the getattr operation to fetch i_version

Now that we can call into vfs_getattr to get the i_version field, use
that facility to fetch it instead of doing it in nfsd4_change_attribute.

Neil also pointed out recently that IS_I_VERSION directory operations
are always logged, and so we only need to mitigate the rollback problem
on regular files. Also, we don't need to factor in the ctime when
reexporting NFS or Ceph.

Set the STATX_CHANGE_COOKIE (and BTIME) bits in the request when we're
dealing with a v4 request. Then, instead of looking at IS_I_VERSION when
generating the change attr, look at the result mask and only use it if
STATX_CHANGE_COOKIE is set.

Change nfsd4_change_attribute to only factor in the ctime if it's a
regular file and the fs doesn't advertise STATX_ATTR_CHANGE_MONOTONIC.

Acked-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: NeilBrown <neilb@suse.de>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
fs/nfsd/nfs4xdr.c
fs/nfsd/nfsfh.c
fs/nfsd/vfs.h