]> git.ipfire.org Git - thirdparty/linux.git/commit
NFSD: Offer write delegation for OPEN with OPEN4_SHARE_ACCESS_WRITE
authorDai Ngo <dai.ngo@oracle.com>
Tue, 13 May 2025 16:08:28 +0000 (09:08 -0700)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 14 Jul 2025 16:46:36 +0000 (12:46 -0400)
commite7a8ebc305f26cab608e59a916a4ae89d6656c5f
treefd6cc99d055e02dca068bf3b2edacc560b5af227
parent347e9f5043c89695b01e66b3ed111755afcf1911
NFSD: Offer write delegation for OPEN with OPEN4_SHARE_ACCESS_WRITE

RFC8881, section 9.1.2 says:

  "In the case of READ, the server may perform the corresponding
   check on the access mode, or it may choose to allow READ for
   OPEN4_SHARE_ACCESS_WRITE, to accommodate clients whose WRITE
   implementation may unavoidably do reads (e.g., due to buffer cache
   constraints)."

and in section 10.4.1:
   "Similarly, when closing a file opened for OPEN4_SHARE_ACCESS_WRITE/
   OPEN4_SHARE_ACCESS_BOTH and if an OPEN_DELEGATE_WRITE delegation
   is in effect"

This patch allows READ using write delegation stateid granted on OPENs
with OPEN4_SHARE_ACCESS_WRITE only, to accommodate clients whose WRITE
implementation may unavoidably do (e.g., due to buffer cache
constraints).

For write delegation granted for OPEN with OPEN4_SHARE_ACCESS_WRITE
a new nfsd_file and a struct file are allocated to use for reads.
The nfsd_file is freed when the file is closed by release_all_access.

Suggested-by: Chuck Lever <chuck.lever@oracle.com>
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