From owner-svn-src-projects@freebsd.org Thu Jun 7 19:48:50 2018 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8DE35FE9BCB for ; Thu, 7 Jun 2018 19:48:50 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3F4F07BB5D; Thu, 7 Jun 2018 19:48:50 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1F32D24A0B; Thu, 7 Jun 2018 19:48:50 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w57Jmn0e026153; Thu, 7 Jun 2018 19:48:49 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w57JmnJf026149; Thu, 7 Jun 2018 19:48:49 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201806071948.w57JmnJf026149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 7 Jun 2018 19:48:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r334812 - in projects/pnfs-planb-server/sys/fs: nfs nfsserver X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in projects/pnfs-planb-server/sys/fs: nfs nfsserver X-SVN-Commit-Revision: 334812 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jun 2018 19:48:50 -0000 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); }