svn commit: r334812 - in projects/pnfs-planb-server/sys/fs: nfs nfsserver

Rick Macklem rmacklem at FreeBSD.org
Thu Jun 7 19:48:50 UTC 2018


Author: rmacklem
Date: Thu Jun  7 19:48:49 2018
New Revision: 334812
URL: https://svnweb.freebsd.org/changeset/base/334812

Log:
  Move nfsrv_setacl() from sys/fs/nfs (the common module) to sys/fs/nfsserver
  (the nfsd module) since it is only called from the server.
  This is needed, since it now calls nfsrv_dssetacl(), which is in the server.
  Found during "make universe" for kernels that have "options NFSCL", but not
  "options NFSD".

Modified:
  projects/pnfs-planb-server/sys/fs/nfs/nfs_commonacl.c
  projects/pnfs-planb-server/sys/fs/nfs/nfs_var.h
  projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c

Modified: projects/pnfs-planb-server/sys/fs/nfs/nfs_commonacl.c
==============================================================================
--- projects/pnfs-planb-server/sys/fs/nfs/nfs_commonacl.c	Thu Jun  7 19:39:11 2018	(r334811)
+++ projects/pnfs-planb-server/sys/fs/nfs/nfs_commonacl.c	Thu Jun  7 19:48:49 2018	(r334812)
@@ -450,41 +450,6 @@ nfsrv_buildacl(struct nfsrv_descript *nd, NFSACL_T *ac
 }
 
 /*
- * Set an NFSv4 acl.
- */
-APPLESTATIC int
-nfsrv_setacl(vnode_t vp, NFSACL_T *aclp, struct ucred *cred,
-    NFSPROC_T *p)
-{
-	int error;
-
-	if (nfsrv_useacl == 0 || nfs_supportsnfsv4acls(vp) == 0) {
-		error = NFSERR_ATTRNOTSUPP;
-		goto out;
-	}
-	/*
-	 * With NFSv4 ACLs, chmod(2) may need to add additional entries.
-	 * Make sure it has enough room for that - splitting every entry
-	 * into two and appending "canonical six" entries at the end.
-	 * Cribbed out of kern/vfs_acl.c - Rick M.
-	 */
-	if (aclp->acl_cnt > (ACL_MAX_ENTRIES - 6) / 2) {
-		error = NFSERR_ATTRNOTSUPP;
-		goto out;
-	}
-	error = VOP_SETACL(vp, ACL_TYPE_NFS4, aclp, cred, p);
-	if (error == 0) {
-		error = nfsrv_dssetacl(vp, aclp, cred, p);
-		if (error == ENOENT)
-			error = 0;
-	}
-
-out:
-	NFSEXITCODE(error);
-	return (error);
-}
-
-/*
  * Compare two NFSv4 acls.
  * Return 0 if they are the same, 1 if not the same.
  */

Modified: projects/pnfs-planb-server/sys/fs/nfs/nfs_var.h
==============================================================================
--- projects/pnfs-planb-server/sys/fs/nfs/nfs_var.h	Thu Jun  7 19:39:11 2018	(r334811)
+++ projects/pnfs-planb-server/sys/fs/nfs/nfs_var.h	Thu Jun  7 19:48:49 2018	(r334812)
@@ -426,8 +426,6 @@ int nfsrv_dissectace(struct nfsrv_descript *, struct a
     int *, int *, NFSPROC_T *);
 int nfsrv_buildacl(struct nfsrv_descript *, NFSACL_T *, enum vtype,
     NFSPROC_T *);
-int nfsrv_setacl(vnode_t, NFSACL_T *, struct ucred *,
-    NFSPROC_T *);
 int nfsrv_compareacl(NFSACL_T *, NFSACL_T *);
 
 /* nfs_clrpcops.c */
@@ -716,8 +714,8 @@ int nfsrv_dscreate(struct vnode *, struct vattr *, str
     fhandle_t *, struct pnfsdsfile *, struct pnfsdsattr *, char *,
     struct ucred *, NFSPROC_T *, struct vnode **);
 int nfsrv_updatemdsattr(struct vnode *, struct nfsvattr *, NFSPROC_T *);
-int nfsrv_dssetacl(struct vnode *, struct acl *, struct ucred *, NFSPROC_T *);
 void nfsrv_killrpcs(struct nfsmount *);
+int nfsrv_setacl(struct vnode *, NFSACL_T *, struct ucred *, NFSPROC_T *);
 
 /* nfs_commonkrpc.c */
 int newnfs_nmcancelreqs(struct nfsmount *);

Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c
==============================================================================
--- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c	Thu Jun  7 19:39:11 2018	(r334811)
+++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c	Thu Jun  7 19:48:49 2018	(r334812)
@@ -131,6 +131,8 @@ static int nfsrv_pnfslookupds(struct vnode *, struct v
 static void nfsrv_pnfssetfh(struct vnode *, struct pnfsdsfile *,
     struct vnode *, NFSPROC_T *);
 static int nfsrv_dsremove(struct vnode *, char *, struct ucred *, NFSPROC_T *);
+static int nfsrv_dssetacl(struct vnode *, struct acl *, struct ucred *,
+    NFSPROC_T *);
 static int nfsrv_pnfsstatfs(struct statfs *);
 
 int nfs_pnfsio(task_fn_t *, void *);
@@ -4250,7 +4252,7 @@ nfsrv_updatemdsattr(struct vnode *vp, struct nfsvattr 
 /*
  * Set the NFSv4 ACL on the DS file to the same ACL as the MDS file.
  */
-int
+static int
 nfsrv_dssetacl(struct vnode *vp, struct acl *aclp, struct ucred *cred,
     NFSPROC_T *p)
 {
@@ -5550,6 +5552,40 @@ nfsrv_pnfsstatfs(struct statfs *sf)
 	}
 	free(tsf, M_TEMP);
 	free(dvpp, M_TEMP);
+	return (error);
+}
+
+/*
+ * Set an NFSv4 acl.
+ */
+int
+nfsrv_setacl(struct vnode *vp, NFSACL_T *aclp, struct ucred *cred, NFSPROC_T *p)
+{
+	int error;
+
+	if (nfsrv_useacl == 0 || nfs_supportsnfsv4acls(vp) == 0) {
+		error = NFSERR_ATTRNOTSUPP;
+		goto out;
+	}
+	/*
+	 * With NFSv4 ACLs, chmod(2) may need to add additional entries.
+	 * Make sure it has enough room for that - splitting every entry
+	 * into two and appending "canonical six" entries at the end.
+	 * Cribbed out of kern/vfs_acl.c - Rick M.
+	 */
+	if (aclp->acl_cnt > (ACL_MAX_ENTRIES - 6) / 2) {
+		error = NFSERR_ATTRNOTSUPP;
+		goto out;
+	}
+	error = VOP_SETACL(vp, ACL_TYPE_NFS4, aclp, cred, p);
+	if (error == 0) {
+		error = nfsrv_dssetacl(vp, aclp, cred, p);
+		if (error == ENOENT)
+			error = 0;
+	}
+
+out:
+	NFSEXITCODE(error);
 	return (error);
 }
 


More information about the svn-src-projects mailing list