xref: /openbmc/linux/fs/nfsd/nfs2acl.c (revision 9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e)
1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
2a257cdd0SAndreas Gruenbacher /*
3a257cdd0SAndreas Gruenbacher  * Process version 2 NFSACL requests.
4a257cdd0SAndreas Gruenbacher  *
5a257cdd0SAndreas Gruenbacher  * Copyright (C) 2002-2003 Andreas Gruenbacher <agruen@suse.de>
6a257cdd0SAndreas Gruenbacher  */
7a257cdd0SAndreas Gruenbacher 
89a74af21SBoaz Harrosh #include "nfsd.h"
99a74af21SBoaz Harrosh /* FIXME: nfsacl.h is a broken header */
10a257cdd0SAndreas Gruenbacher #include <linux/nfsacl.h>
115a0e3ad6STejun Heo #include <linux/gfp.h>
129a74af21SBoaz Harrosh #include "cache.h"
139a74af21SBoaz Harrosh #include "xdr3.h"
140a3adadeSJ. Bruce Fields #include "vfs.h"
15a257cdd0SAndreas Gruenbacher 
16a257cdd0SAndreas Gruenbacher #define NFSDDBG_FACILITY		NFSDDBG_PROC
17a257cdd0SAndreas Gruenbacher 
18a257cdd0SAndreas Gruenbacher /*
19a257cdd0SAndreas Gruenbacher  * NULL call.
20a257cdd0SAndreas Gruenbacher  */
217111c66eSAl Viro static __be32
nfsacld_proc_null(struct svc_rqst * rqstp)22a6beb732SChristoph Hellwig nfsacld_proc_null(struct svc_rqst *rqstp)
23a257cdd0SAndreas Gruenbacher {
24cc028a10SChuck Lever 	return rpc_success;
25a257cdd0SAndreas Gruenbacher }
26a257cdd0SAndreas Gruenbacher 
27a257cdd0SAndreas Gruenbacher /*
28a257cdd0SAndreas Gruenbacher  * Get the Access and/or Default ACL of a file.
29a257cdd0SAndreas Gruenbacher  */
nfsacld_proc_getacl(struct svc_rqst * rqstp)30a6beb732SChristoph Hellwig static __be32 nfsacld_proc_getacl(struct svc_rqst *rqstp)
31a257cdd0SAndreas Gruenbacher {
32a6beb732SChristoph Hellwig 	struct nfsd3_getaclargs *argp = rqstp->rq_argp;
33a6beb732SChristoph Hellwig 	struct nfsd3_getaclres *resp = rqstp->rq_resp;
34a257cdd0SAndreas Gruenbacher 	struct posix_acl *acl;
354ac7249eSChristoph Hellwig 	struct inode *inode;
364ac7249eSChristoph Hellwig 	svc_fh *fh;
37a257cdd0SAndreas Gruenbacher 
38a257cdd0SAndreas Gruenbacher 	dprintk("nfsd: GETACL(2acl)   %s\n", SVCFH_fmt(&argp->fh));
39a257cdd0SAndreas Gruenbacher 
40a257cdd0SAndreas Gruenbacher 	fh = fh_copy(&resp->fh, &argp->fh);
41f0af2210SChuck Lever 	resp->status = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP);
42f0af2210SChuck Lever 	if (resp->status != nfs_ok)
43f0af2210SChuck Lever 		goto out;
44a257cdd0SAndreas Gruenbacher 
452b0143b5SDavid Howells 	inode = d_inode(fh->fh_dentry);
464ac7249eSChristoph Hellwig 
47f0af2210SChuck Lever 	if (argp->mask & ~NFS_ACL_MASK) {
48f0af2210SChuck Lever 		resp->status = nfserr_inval;
49f0af2210SChuck Lever 		goto out;
50f0af2210SChuck Lever 	}
51a257cdd0SAndreas Gruenbacher 	resp->mask = argp->mask;
52a257cdd0SAndreas Gruenbacher 
53f0af2210SChuck Lever 	resp->status = fh_getattr(fh, &resp->stat);
54f0af2210SChuck Lever 	if (resp->status != nfs_ok)
55f0af2210SChuck Lever 		goto out;
564f4a4fadSJ. Bruce Fields 
57a257cdd0SAndreas Gruenbacher 	if (resp->mask & (NFS_ACL|NFS_ACLCNT)) {
58cac2f8b8SChristian Brauner 		acl = get_inode_acl(inode, ACL_TYPE_ACCESS);
59a257cdd0SAndreas Gruenbacher 		if (acl == NULL) {
60a257cdd0SAndreas Gruenbacher 			/* Solaris returns the inode's minimum ACL. */
61a257cdd0SAndreas Gruenbacher 			acl = posix_acl_from_mode(inode->i_mode, GFP_KERNEL);
62a257cdd0SAndreas Gruenbacher 		}
6335e634b8SKinglong Mee 		if (IS_ERR(acl)) {
64f0af2210SChuck Lever 			resp->status = nfserrno(PTR_ERR(acl));
6535e634b8SKinglong Mee 			goto fail;
6635e634b8SKinglong Mee 		}
67a257cdd0SAndreas Gruenbacher 		resp->acl_access = acl;
68a257cdd0SAndreas Gruenbacher 	}
69a257cdd0SAndreas Gruenbacher 	if (resp->mask & (NFS_DFACL|NFS_DFACLCNT)) {
70a257cdd0SAndreas Gruenbacher 		/* Check how Solaris handles requests for the Default ACL
71a257cdd0SAndreas Gruenbacher 		   of a non-directory! */
72cac2f8b8SChristian Brauner 		acl = get_inode_acl(inode, ACL_TYPE_DEFAULT);
73a257cdd0SAndreas Gruenbacher 		if (IS_ERR(acl)) {
74f0af2210SChuck Lever 			resp->status = nfserrno(PTR_ERR(acl));
75a257cdd0SAndreas Gruenbacher 			goto fail;
76a257cdd0SAndreas Gruenbacher 		}
77a257cdd0SAndreas Gruenbacher 		resp->acl_default = acl;
78a257cdd0SAndreas Gruenbacher 	}
79a257cdd0SAndreas Gruenbacher 
80a257cdd0SAndreas Gruenbacher 	/* resp->acl_{access,default} are released in nfssvc_release_getacl. */
81f0af2210SChuck Lever out:
82cc028a10SChuck Lever 	return rpc_success;
83a257cdd0SAndreas Gruenbacher 
84a257cdd0SAndreas Gruenbacher fail:
85a257cdd0SAndreas Gruenbacher 	posix_acl_release(resp->acl_access);
86a257cdd0SAndreas Gruenbacher 	posix_acl_release(resp->acl_default);
87f0af2210SChuck Lever 	goto out;
88a257cdd0SAndreas Gruenbacher }
89a257cdd0SAndreas Gruenbacher 
90a257cdd0SAndreas Gruenbacher /*
91a257cdd0SAndreas Gruenbacher  * Set the Access and/or Default ACL of a file.
92a257cdd0SAndreas Gruenbacher  */
nfsacld_proc_setacl(struct svc_rqst * rqstp)93a6beb732SChristoph Hellwig static __be32 nfsacld_proc_setacl(struct svc_rqst *rqstp)
94a257cdd0SAndreas Gruenbacher {
95a6beb732SChristoph Hellwig 	struct nfsd3_setaclargs *argp = rqstp->rq_argp;
96a6beb732SChristoph Hellwig 	struct nfsd_attrstat *resp = rqstp->rq_resp;
974ac7249eSChristoph Hellwig 	struct inode *inode;
98a257cdd0SAndreas Gruenbacher 	svc_fh *fh;
994ac7249eSChristoph Hellwig 	int error;
100a257cdd0SAndreas Gruenbacher 
101a257cdd0SAndreas Gruenbacher 	dprintk("nfsd: SETACL(2acl)   %s\n", SVCFH_fmt(&argp->fh));
102a257cdd0SAndreas Gruenbacher 
103a257cdd0SAndreas Gruenbacher 	fh = fh_copy(&resp->fh, &argp->fh);
104f0af2210SChuck Lever 	resp->status = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_SATTR);
105f0af2210SChuck Lever 	if (resp->status != nfs_ok)
1064ac7249eSChristoph Hellwig 		goto out;
107a257cdd0SAndreas Gruenbacher 
1082b0143b5SDavid Howells 	inode = d_inode(fh->fh_dentry);
1094ac7249eSChristoph Hellwig 
1104ac7249eSChristoph Hellwig 	error = fh_want_write(fh);
1114ac7249eSChristoph Hellwig 	if (error)
1124ac7249eSChristoph Hellwig 		goto out_errno;
1134ac7249eSChristoph Hellwig 
114bb4d53d6SNeilBrown 	inode_lock(inode);
11599965378SBen Hutchings 
11613e83a49SChristian Brauner 	error = set_posix_acl(&nop_mnt_idmap, fh->fh_dentry, ACL_TYPE_ACCESS,
117e65ce2a5SChristian Brauner 			      argp->acl_access);
1184ac7249eSChristoph Hellwig 	if (error)
11999965378SBen Hutchings 		goto out_drop_lock;
12013e83a49SChristian Brauner 	error = set_posix_acl(&nop_mnt_idmap, fh->fh_dentry, ACL_TYPE_DEFAULT,
121e65ce2a5SChristian Brauner 			      argp->acl_default);
1224ac7249eSChristoph Hellwig 	if (error)
12399965378SBen Hutchings 		goto out_drop_lock;
12499965378SBen Hutchings 
125bb4d53d6SNeilBrown 	inode_unlock(inode);
1264ac7249eSChristoph Hellwig 
1274ac7249eSChristoph Hellwig 	fh_drop_write(fh);
1284ac7249eSChristoph Hellwig 
129f0af2210SChuck Lever 	resp->status = fh_getattr(fh, &resp->stat);
130a257cdd0SAndreas Gruenbacher 
1314ac7249eSChristoph Hellwig out:
132a257cdd0SAndreas Gruenbacher 	/* argp->acl_{access,default} may have been allocated in
133a257cdd0SAndreas Gruenbacher 	   nfssvc_decode_setaclargs. */
134a257cdd0SAndreas Gruenbacher 	posix_acl_release(argp->acl_access);
135a257cdd0SAndreas Gruenbacher 	posix_acl_release(argp->acl_default);
136cc028a10SChuck Lever 	return rpc_success;
137f0af2210SChuck Lever 
13899965378SBen Hutchings out_drop_lock:
139bb4d53d6SNeilBrown 	inode_unlock(inode);
1404ac7249eSChristoph Hellwig 	fh_drop_write(fh);
1414ac7249eSChristoph Hellwig out_errno:
142f0af2210SChuck Lever 	resp->status = nfserrno(error);
1434ac7249eSChristoph Hellwig 	goto out;
144a257cdd0SAndreas Gruenbacher }
145a257cdd0SAndreas Gruenbacher 
146a257cdd0SAndreas Gruenbacher /*
147a257cdd0SAndreas Gruenbacher  * Check file attributes
148a257cdd0SAndreas Gruenbacher  */
nfsacld_proc_getattr(struct svc_rqst * rqstp)149a6beb732SChristoph Hellwig static __be32 nfsacld_proc_getattr(struct svc_rqst *rqstp)
150a257cdd0SAndreas Gruenbacher {
151a6beb732SChristoph Hellwig 	struct nfsd_fhandle *argp = rqstp->rq_argp;
152a6beb732SChristoph Hellwig 	struct nfsd_attrstat *resp = rqstp->rq_resp;
153f0af2210SChuck Lever 
154a257cdd0SAndreas Gruenbacher 	dprintk("nfsd: GETATTR  %s\n", SVCFH_fmt(&argp->fh));
155a257cdd0SAndreas Gruenbacher 
156a257cdd0SAndreas Gruenbacher 	fh_copy(&resp->fh, &argp->fh);
157f0af2210SChuck Lever 	resp->status = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP);
158f0af2210SChuck Lever 	if (resp->status != nfs_ok)
159f0af2210SChuck Lever 		goto out;
160f0af2210SChuck Lever 	resp->status = fh_getattr(&resp->fh, &resp->stat);
161f0af2210SChuck Lever out:
162cc028a10SChuck Lever 	return rpc_success;
163a257cdd0SAndreas Gruenbacher }
164a257cdd0SAndreas Gruenbacher 
165a257cdd0SAndreas Gruenbacher /*
166a257cdd0SAndreas Gruenbacher  * Check file access
167a257cdd0SAndreas Gruenbacher  */
nfsacld_proc_access(struct svc_rqst * rqstp)168a6beb732SChristoph Hellwig static __be32 nfsacld_proc_access(struct svc_rqst *rqstp)
169a257cdd0SAndreas Gruenbacher {
170a6beb732SChristoph Hellwig 	struct nfsd3_accessargs *argp = rqstp->rq_argp;
171a6beb732SChristoph Hellwig 	struct nfsd3_accessres *resp = rqstp->rq_resp;
172a257cdd0SAndreas Gruenbacher 
173a257cdd0SAndreas Gruenbacher 	dprintk("nfsd: ACCESS(2acl)   %s 0x%x\n",
174a257cdd0SAndreas Gruenbacher 			SVCFH_fmt(&argp->fh),
175a257cdd0SAndreas Gruenbacher 			argp->access);
176a257cdd0SAndreas Gruenbacher 
177a257cdd0SAndreas Gruenbacher 	fh_copy(&resp->fh, &argp->fh);
178a257cdd0SAndreas Gruenbacher 	resp->access = argp->access;
179f0af2210SChuck Lever 	resp->status = nfsd_access(rqstp, &resp->fh, &resp->access, NULL);
180f0af2210SChuck Lever 	if (resp->status != nfs_ok)
181f0af2210SChuck Lever 		goto out;
182f0af2210SChuck Lever 	resp->status = fh_getattr(&resp->fh, &resp->stat);
183f0af2210SChuck Lever out:
184cc028a10SChuck Lever 	return rpc_success;
185a257cdd0SAndreas Gruenbacher }
186a257cdd0SAndreas Gruenbacher 
187a257cdd0SAndreas Gruenbacher /*
188a257cdd0SAndreas Gruenbacher  * XDR decode functions
189a257cdd0SAndreas Gruenbacher  */
190dcc46991SChuck Lever 
191c44b31c2SChuck Lever static bool
nfsaclsvc_decode_getaclargs(struct svc_rqst * rqstp,struct xdr_stream * xdr)19216c66364SChuck Lever nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
193a257cdd0SAndreas Gruenbacher {
194026fec7eSChristoph Hellwig 	struct nfsd3_getaclargs *argp = rqstp->rq_argp;
195026fec7eSChristoph Hellwig 
196635a45d3SChuck Lever 	if (!svcxdr_decode_fhandle(xdr, &argp->fh))
197c44b31c2SChuck Lever 		return false;
198635a45d3SChuck Lever 	if (xdr_stream_decode_u32(xdr, &argp->mask) < 0)
199c44b31c2SChuck Lever 		return false;
200a257cdd0SAndreas Gruenbacher 
201c44b31c2SChuck Lever 	return true;
202a257cdd0SAndreas Gruenbacher }
203a257cdd0SAndreas Gruenbacher 
204c44b31c2SChuck Lever static bool
nfsaclsvc_decode_setaclargs(struct svc_rqst * rqstp,struct xdr_stream * xdr)20516c66364SChuck Lever nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
206a257cdd0SAndreas Gruenbacher {
207026fec7eSChristoph Hellwig 	struct nfsd3_setaclargs *argp = rqstp->rq_argp;
208a257cdd0SAndreas Gruenbacher 
209427eab3bSChuck Lever 	if (!svcxdr_decode_fhandle(xdr, &argp->fh))
210c44b31c2SChuck Lever 		return false;
211427eab3bSChuck Lever 	if (xdr_stream_decode_u32(xdr, &argp->mask) < 0)
212c44b31c2SChuck Lever 		return false;
213427eab3bSChuck Lever 	if (argp->mask & ~NFS_ACL_MASK)
214c44b31c2SChuck Lever 		return false;
215427eab3bSChuck Lever 	if (!nfs_stream_decode_acl(xdr, NULL, (argp->mask & NFS_ACL) ?
216427eab3bSChuck Lever 				   &argp->acl_access : NULL))
217c44b31c2SChuck Lever 		return false;
218427eab3bSChuck Lever 	if (!nfs_stream_decode_acl(xdr, NULL, (argp->mask & NFS_DFACL) ?
219427eab3bSChuck Lever 				   &argp->acl_default : NULL))
220c44b31c2SChuck Lever 		return false;
221a257cdd0SAndreas Gruenbacher 
222c44b31c2SChuck Lever 	return true;
223a257cdd0SAndreas Gruenbacher }
224a257cdd0SAndreas Gruenbacher 
225c44b31c2SChuck Lever static bool
nfsaclsvc_decode_accessargs(struct svc_rqst * rqstp,struct xdr_stream * xdr)22616c66364SChuck Lever nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
227a257cdd0SAndreas Gruenbacher {
22864063892SChuck Lever 	struct nfsd3_accessargs *args = rqstp->rq_argp;
229026fec7eSChristoph Hellwig 
23064063892SChuck Lever 	if (!svcxdr_decode_fhandle(xdr, &args->fh))
231c44b31c2SChuck Lever 		return false;
23264063892SChuck Lever 	if (xdr_stream_decode_u32(xdr, &args->access) < 0)
233c44b31c2SChuck Lever 		return false;
234a257cdd0SAndreas Gruenbacher 
235c44b31c2SChuck Lever 	return true;
236a257cdd0SAndreas Gruenbacher }
237a257cdd0SAndreas Gruenbacher 
238a257cdd0SAndreas Gruenbacher /*
239a257cdd0SAndreas Gruenbacher  * XDR encode functions
240a257cdd0SAndreas Gruenbacher  */
241a257cdd0SAndreas Gruenbacher 
242a257cdd0SAndreas Gruenbacher /* GETACL */
243130e2054SChuck Lever static bool
nfsaclsvc_encode_getaclres(struct svc_rqst * rqstp,struct xdr_stream * xdr)244fda49441SChuck Lever nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
245a257cdd0SAndreas Gruenbacher {
24663f8de37SChristoph Hellwig 	struct nfsd3_getaclres *resp = rqstp->rq_resp;
247a257cdd0SAndreas Gruenbacher 	struct dentry *dentry = resp->fh.fh_dentry;
248aefa89d1SPrasad P 	struct inode *inode;
249a257cdd0SAndreas Gruenbacher 
250f8cba473SChuck Lever 	if (!svcxdr_encode_stat(xdr, resp->status))
2515f7b839dSHaowen Bai 		return false;
252f8cba473SChuck Lever 
253f8cba473SChuck Lever 	if (dentry == NULL || d_really_is_negative(dentry))
2545f7b839dSHaowen Bai 		return true;
2552b0143b5SDavid Howells 	inode = d_inode(dentry);
256a257cdd0SAndreas Gruenbacher 
257f8cba473SChuck Lever 	if (!svcxdr_encode_fattr(rqstp, xdr, &resp->fh, &resp->stat))
2585f7b839dSHaowen Bai 		return false;
259f8cba473SChuck Lever 	if (xdr_stream_encode_u32(xdr, resp->mask) < 0)
2605f7b839dSHaowen Bai 		return false;
261a257cdd0SAndreas Gruenbacher 
262f8cba473SChuck Lever 	if (!nfs_stream_encode_acl(xdr, inode, resp->acl_access,
263f8cba473SChuck Lever 				   resp->mask & NFS_ACL, 0))
2645f7b839dSHaowen Bai 		return false;
265f8cba473SChuck Lever 	if (!nfs_stream_encode_acl(xdr, inode, resp->acl_default,
266f8cba473SChuck Lever 				   resp->mask & NFS_DFACL, NFS_ACL_DEFAULT))
2675f7b839dSHaowen Bai 		return false;
268f8cba473SChuck Lever 
2695f7b839dSHaowen Bai 	return true;
270a257cdd0SAndreas Gruenbacher }
271a257cdd0SAndreas Gruenbacher 
272a257cdd0SAndreas Gruenbacher /* ACCESS */
273130e2054SChuck Lever static bool
nfsaclsvc_encode_accessres(struct svc_rqst * rqstp,struct xdr_stream * xdr)274fda49441SChuck Lever nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
275a257cdd0SAndreas Gruenbacher {
27663f8de37SChristoph Hellwig 	struct nfsd3_accessres *resp = rqstp->rq_resp;
27763f8de37SChristoph Hellwig 
27807f5c296SChuck Lever 	if (!svcxdr_encode_stat(xdr, resp->status))
2795f7b839dSHaowen Bai 		return false;
28007f5c296SChuck Lever 	switch (resp->status) {
28107f5c296SChuck Lever 	case nfs_ok:
28207f5c296SChuck Lever 		if (!svcxdr_encode_fattr(rqstp, xdr, &resp->fh, &resp->stat))
2835f7b839dSHaowen Bai 			return false;
28407f5c296SChuck Lever 		if (xdr_stream_encode_u32(xdr, resp->access) < 0)
2855f7b839dSHaowen Bai 			return false;
28607f5c296SChuck Lever 		break;
28707f5c296SChuck Lever 	}
288f0af2210SChuck Lever 
2895f7b839dSHaowen Bai 	return true;
290a257cdd0SAndreas Gruenbacher }
291a257cdd0SAndreas Gruenbacher 
292a257cdd0SAndreas Gruenbacher /*
293a257cdd0SAndreas Gruenbacher  * XDR release functions
294a257cdd0SAndreas Gruenbacher  */
nfsaclsvc_release_getacl(struct svc_rqst * rqstp)2958537488bSChristoph Hellwig static void nfsaclsvc_release_getacl(struct svc_rqst *rqstp)
296a257cdd0SAndreas Gruenbacher {
2978537488bSChristoph Hellwig 	struct nfsd3_getaclres *resp = rqstp->rq_resp;
2988537488bSChristoph Hellwig 
299a257cdd0SAndreas Gruenbacher 	fh_put(&resp->fh);
300a257cdd0SAndreas Gruenbacher 	posix_acl_release(resp->acl_access);
301a257cdd0SAndreas Gruenbacher 	posix_acl_release(resp->acl_default);
302a257cdd0SAndreas Gruenbacher }
303a257cdd0SAndreas Gruenbacher 
nfsaclsvc_release_access(struct svc_rqst * rqstp)3048537488bSChristoph Hellwig static void nfsaclsvc_release_access(struct svc_rqst *rqstp)
305a257cdd0SAndreas Gruenbacher {
3068537488bSChristoph Hellwig 	struct nfsd3_accessres *resp = rqstp->rq_resp;
3078537488bSChristoph Hellwig 
308a257cdd0SAndreas Gruenbacher 	fh_put(&resp->fh);
309a257cdd0SAndreas Gruenbacher }
310a257cdd0SAndreas Gruenbacher 
311a257cdd0SAndreas Gruenbacher struct nfsd3_voidargs { int dummy; };
312a257cdd0SAndreas Gruenbacher 
313a257cdd0SAndreas Gruenbacher #define ST 1		/* status*/
314a257cdd0SAndreas Gruenbacher #define AT 21		/* attributes */
315a257cdd0SAndreas Gruenbacher #define pAT (1+AT)	/* post attributes - conditional */
316a257cdd0SAndreas Gruenbacher #define ACL (1+NFS_ACL_MAX_ENTRIES*3)  /* Access Control List */
317a257cdd0SAndreas Gruenbacher 
318ba1df797SChuck Lever static const struct svc_procedure nfsd_acl_procedures2[5] = {
319ba1df797SChuck Lever 	[ACLPROC2_NULL] = {
320ba1df797SChuck Lever 		.pc_func = nfsacld_proc_null,
321788f7183SChuck Lever 		.pc_decode = nfssvc_decode_voidarg,
322788f7183SChuck Lever 		.pc_encode = nfssvc_encode_voidres,
323788f7183SChuck Lever 		.pc_argsize = sizeof(struct nfsd_voidargs),
324103cc1faSChuck Lever 		.pc_argzero = sizeof(struct nfsd_voidargs),
325788f7183SChuck Lever 		.pc_ressize = sizeof(struct nfsd_voidres),
326ba1df797SChuck Lever 		.pc_cachetype = RC_NOCACHE,
327ba1df797SChuck Lever 		.pc_xdrressize = ST,
3282289e87bSChuck Lever 		.pc_name = "NULL",
329ba1df797SChuck Lever 	},
330ba1df797SChuck Lever 	[ACLPROC2_GETACL] = {
331ba1df797SChuck Lever 		.pc_func = nfsacld_proc_getacl,
332ba1df797SChuck Lever 		.pc_decode = nfsaclsvc_decode_getaclargs,
333ba1df797SChuck Lever 		.pc_encode = nfsaclsvc_encode_getaclres,
334ba1df797SChuck Lever 		.pc_release = nfsaclsvc_release_getacl,
335ba1df797SChuck Lever 		.pc_argsize = sizeof(struct nfsd3_getaclargs),
336103cc1faSChuck Lever 		.pc_argzero = sizeof(struct nfsd3_getaclargs),
337ba1df797SChuck Lever 		.pc_ressize = sizeof(struct nfsd3_getaclres),
338ba1df797SChuck Lever 		.pc_cachetype = RC_NOCACHE,
339ba1df797SChuck Lever 		.pc_xdrressize = ST+1+2*(1+ACL),
3402289e87bSChuck Lever 		.pc_name = "GETACL",
341ba1df797SChuck Lever 	},
342ba1df797SChuck Lever 	[ACLPROC2_SETACL] = {
343ba1df797SChuck Lever 		.pc_func = nfsacld_proc_setacl,
344ba1df797SChuck Lever 		.pc_decode = nfsaclsvc_decode_setaclargs,
345778f068fSChuck Lever 		.pc_encode = nfssvc_encode_attrstatres,
346778f068fSChuck Lever 		.pc_release = nfssvc_release_attrstat,
347ba1df797SChuck Lever 		.pc_argsize = sizeof(struct nfsd3_setaclargs),
348103cc1faSChuck Lever 		.pc_argzero = sizeof(struct nfsd3_setaclargs),
349ba1df797SChuck Lever 		.pc_ressize = sizeof(struct nfsd_attrstat),
350ba1df797SChuck Lever 		.pc_cachetype = RC_NOCACHE,
351ba1df797SChuck Lever 		.pc_xdrressize = ST+AT,
3522289e87bSChuck Lever 		.pc_name = "SETACL",
353ba1df797SChuck Lever 	},
354ba1df797SChuck Lever 	[ACLPROC2_GETATTR] = {
355ba1df797SChuck Lever 		.pc_func = nfsacld_proc_getattr,
356571d31f3SChuck Lever 		.pc_decode = nfssvc_decode_fhandleargs,
3578d2009a1SChuck Lever 		.pc_encode = nfssvc_encode_attrstatres,
3588d2009a1SChuck Lever 		.pc_release = nfssvc_release_attrstat,
359ba1df797SChuck Lever 		.pc_argsize = sizeof(struct nfsd_fhandle),
360103cc1faSChuck Lever 		.pc_argzero = sizeof(struct nfsd_fhandle),
361ba1df797SChuck Lever 		.pc_ressize = sizeof(struct nfsd_attrstat),
362ba1df797SChuck Lever 		.pc_cachetype = RC_NOCACHE,
363ba1df797SChuck Lever 		.pc_xdrressize = ST+AT,
3642289e87bSChuck Lever 		.pc_name = "GETATTR",
365ba1df797SChuck Lever 	},
366ba1df797SChuck Lever 	[ACLPROC2_ACCESS] = {
367ba1df797SChuck Lever 		.pc_func = nfsacld_proc_access,
368ba1df797SChuck Lever 		.pc_decode = nfsaclsvc_decode_accessargs,
369ba1df797SChuck Lever 		.pc_encode = nfsaclsvc_encode_accessres,
370ba1df797SChuck Lever 		.pc_release = nfsaclsvc_release_access,
371ba1df797SChuck Lever 		.pc_argsize = sizeof(struct nfsd3_accessargs),
372103cc1faSChuck Lever 		.pc_argzero = sizeof(struct nfsd3_accessargs),
373ba1df797SChuck Lever 		.pc_ressize = sizeof(struct nfsd3_accessres),
374ba1df797SChuck Lever 		.pc_cachetype = RC_NOCACHE,
375ba1df797SChuck Lever 		.pc_xdrressize = ST+AT+1,
3762289e87bSChuck Lever 		.pc_name = "SETATTR",
377ba1df797SChuck Lever 	},
378a257cdd0SAndreas Gruenbacher };
379a257cdd0SAndreas Gruenbacher 
380*65ba3d24SChuck Lever static DEFINE_PER_CPU_ALIGNED(unsigned long,
381*65ba3d24SChuck Lever 			      nfsd_acl_count2[ARRAY_SIZE(nfsd_acl_procedures2)]);
382e9679189SChristoph Hellwig const struct svc_version nfsd_acl_version2 = {
383a257cdd0SAndreas Gruenbacher 	.vs_vers	= 2,
384*65ba3d24SChuck Lever 	.vs_nproc	= ARRAY_SIZE(nfsd_acl_procedures2),
385a257cdd0SAndreas Gruenbacher 	.vs_proc	= nfsd_acl_procedures2,
3867fd38af9SChristoph Hellwig 	.vs_count	= nfsd_acl_count2,
387a257cdd0SAndreas Gruenbacher 	.vs_dispatch	= nfsd_dispatch,
388a257cdd0SAndreas Gruenbacher 	.vs_xdrsize	= NFS3_SVC_XDRSIZE,
389a257cdd0SAndreas Gruenbacher };
390