aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/nfsserver/nfs_nfsdserv.c
diff options
context:
space:
mode:
authorRick Macklem <rmacklem@FreeBSD.org>2022-02-02 22:10:16 +0000
committerRick Macklem <rmacklem@FreeBSD.org>2022-02-02 22:10:16 +0000
commite2fe58d61b7ca95cbe87ce841a87c9ae8cecb47b (patch)
tree18a1952e52a7043dadb42ff0f9c9f13f2892ed28 /sys/fs/nfsserver/nfs_nfsdserv.c
parent03f6e182068362df7e1ca87721b8c01ee17f7928 (diff)
downloadsrc-e2fe58d61b7ca95cbe87ce841a87c9ae8cecb47b.tar.gz
src-e2fe58d61b7ca95cbe87ce841a87c9ae8cecb47b.zip
nfsd: Allow file owners to perform Open(Delegate_cur)
Commit b0b7d978b6a8 changed the NFSv4 server's default behaviour to check the file's mode or ACL for permission to open the file, to be Linux and Solaris compatible. However, it turns out that Linux makes an exception for the case of Claim_delegate_cur(_fh). When a NFSv4 client is returning a delegation, it must acquire Opens against the server to replace the ones done locally in the client. The client does this via an Open operation with Claim_delegate_cur(_fh). If this operation fails, due to a change to the file's mode or ACL after the delegation was issued, the client does not have any way to retain the open. As such, the Linux client allows the file's owner to perform an Open with Claim_delegate_cur(_fh) no matter what the mode or ACL allows. This patch makes the FreeBSD server allow this case, to be Linux compatible. This patch only affects the case where delegations are enabled, which is not the default. MFC after: 2 weeks
Diffstat (limited to 'sys/fs/nfsserver/nfs_nfsdserv.c')
-rw-r--r--sys/fs/nfsserver/nfs_nfsdserv.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c
index e5ccbfe7fc37..21d8fe05c0ad 100644
--- a/sys/fs/nfsserver/nfs_nfsdserv.c
+++ b/sys/fs/nfsserver/nfs_nfsdserv.c
@@ -3133,12 +3133,14 @@ nfsrvd_open(struct nfsrv_descript *nd, __unused int isdgram,
* operation's results to be consistent with NFSv3, but that is
* not what the current Linux client appears to be doing.
* Since both the Linux and OpenSolaris NFSv4 servers do this check,
- * I have enabled it by default.
+ * I have enabled it by default. Since Linux does not apply this
+ * check for claim_delegate_cur, this code does the same.
* If this semantic change causes a problem, it can be disabled by
* setting the sysctl vfs.nfsd.v4openaccess to 0 to re-enable the
* previous semantics.
*/
- if (nfsrv_openaccess && create == NFSV4OPEN_NOCREATE)
+ if (nfsrv_openaccess && create == NFSV4OPEN_NOCREATE &&
+ (stp->ls_flags & NFSLCK_DELEGCUR) == 0)
override = NFSACCCHK_NOOVERRIDE;
else
override = NFSACCCHK_ALLOWOWNER;