NFSD: handle GETATTR conflict with write delegation
authorDai Ngo <dai.ngo@oracle.com>
Thu, 15 Feb 2024 22:05:22 +0000 (14:05 -0800)
committerChuck Lever <chuck.lever@oracle.com>
Fri, 1 Mar 2024 14:12:32 +0000 (09:12 -0500)
commitc5967721e1063648b0506481585ba7e2e49a075e
tree0b3f9af15f7f01d346f598c86acd5b2114dde0ec
parent6487a13b5c6bee2ca3fc931f8ad28c8ae887a41f
NFSD: handle GETATTR conflict with write delegation

If the GETATTR request on a file that has write delegation in effect
and the request attributes include the change info and size attribute
then the request is handled as below:

Server sends CB_GETATTR to client to get the latest change info and file
size. If these values are the same as the server's cached values then
the GETATTR proceeds as normal.

If either the change info or file size is different from the server's
cached values, or the file was already marked as modified, then:

    . update time_modify and time_metadata into file's metadata
      with current time

    . encode GETATTR as normal except the file size is encoded with
      the value returned from CB_GETATTR

    . mark the file as modified

If the CB_GETATTR fails for any reasons, the delegation is recalled
and NFS4ERR_DELAY is returned for the GETATTR.

Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs4state.c
fs/nfsd/nfs4xdr.c
fs/nfsd/nfsd.h
fs/nfsd/state.h