xref: /openbmc/linux/fs/nfsd/nfs2acl.c (revision 8d2009a10b3abaa12a39deb4876b215714993fe8)
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
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  */
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)) {
584ac7249eSChristoph Hellwig 		acl = get_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! */
724ac7249eSChristoph Hellwig 		acl = get_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  */
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 
11499965378SBen Hutchings 	fh_lock(fh);
11599965378SBen Hutchings 
116e65ce2a5SChristian Brauner 	error = set_posix_acl(&init_user_ns, inode, ACL_TYPE_ACCESS,
117e65ce2a5SChristian Brauner 			      argp->acl_access);
1184ac7249eSChristoph Hellwig 	if (error)
11999965378SBen Hutchings 		goto out_drop_lock;
120e65ce2a5SChristian Brauner 	error = set_posix_acl(&init_user_ns, inode, ACL_TYPE_DEFAULT,
121e65ce2a5SChristian Brauner 			      argp->acl_default);
1224ac7249eSChristoph Hellwig 	if (error)
12399965378SBen Hutchings 		goto out_drop_lock;
12499965378SBen Hutchings 
12599965378SBen Hutchings 	fh_unlock(fh);
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:
13999965378SBen Hutchings 	fh_unlock(fh);
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  */
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  */
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 
191026fec7eSChristoph Hellwig static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p)
192a257cdd0SAndreas Gruenbacher {
193635a45d3SChuck Lever 	struct xdr_stream *xdr = &rqstp->rq_arg_stream;
194026fec7eSChristoph Hellwig 	struct nfsd3_getaclargs *argp = rqstp->rq_argp;
195026fec7eSChristoph Hellwig 
196635a45d3SChuck Lever 	if (!svcxdr_decode_fhandle(xdr, &argp->fh))
197a257cdd0SAndreas Gruenbacher 		return 0;
198635a45d3SChuck Lever 	if (xdr_stream_decode_u32(xdr, &argp->mask) < 0)
199635a45d3SChuck Lever 		return 0;
200a257cdd0SAndreas Gruenbacher 
201635a45d3SChuck Lever 	return 1;
202a257cdd0SAndreas Gruenbacher }
203a257cdd0SAndreas Gruenbacher 
204026fec7eSChristoph Hellwig static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p)
205a257cdd0SAndreas Gruenbacher {
206427eab3bSChuck Lever 	struct xdr_stream *xdr = &rqstp->rq_arg_stream;
207026fec7eSChristoph Hellwig 	struct nfsd3_setaclargs *argp = rqstp->rq_argp;
208a257cdd0SAndreas Gruenbacher 
209427eab3bSChuck Lever 	if (!svcxdr_decode_fhandle(xdr, &argp->fh))
210a257cdd0SAndreas Gruenbacher 		return 0;
211427eab3bSChuck Lever 	if (xdr_stream_decode_u32(xdr, &argp->mask) < 0)
212427eab3bSChuck Lever 		return 0;
213427eab3bSChuck Lever 	if (argp->mask & ~NFS_ACL_MASK)
214427eab3bSChuck Lever 		return 0;
215427eab3bSChuck Lever 	if (!nfs_stream_decode_acl(xdr, NULL, (argp->mask & NFS_ACL) ?
216427eab3bSChuck Lever 				   &argp->acl_access : NULL))
217427eab3bSChuck Lever 		return 0;
218427eab3bSChuck Lever 	if (!nfs_stream_decode_acl(xdr, NULL, (argp->mask & NFS_DFACL) ?
219427eab3bSChuck Lever 				   &argp->acl_default : NULL))
220a257cdd0SAndreas Gruenbacher 		return 0;
221a257cdd0SAndreas Gruenbacher 
222427eab3bSChuck Lever 	return 1;
223a257cdd0SAndreas Gruenbacher }
224a257cdd0SAndreas Gruenbacher 
225026fec7eSChristoph Hellwig static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p)
226a257cdd0SAndreas Gruenbacher {
22764063892SChuck Lever 	struct xdr_stream *xdr = &rqstp->rq_arg_stream;
22864063892SChuck Lever 	struct nfsd3_accessargs *args = rqstp->rq_argp;
229026fec7eSChristoph Hellwig 
23064063892SChuck Lever 	if (!svcxdr_decode_fhandle(xdr, &args->fh))
231a257cdd0SAndreas Gruenbacher 		return 0;
23264063892SChuck Lever 	if (xdr_stream_decode_u32(xdr, &args->access) < 0)
23364063892SChuck Lever 		return 0;
234a257cdd0SAndreas Gruenbacher 
23564063892SChuck Lever 	return 1;
236a257cdd0SAndreas Gruenbacher }
237a257cdd0SAndreas Gruenbacher 
238a257cdd0SAndreas Gruenbacher /*
239a257cdd0SAndreas Gruenbacher  * XDR encode functions
240a257cdd0SAndreas Gruenbacher  */
241a257cdd0SAndreas Gruenbacher 
242a257cdd0SAndreas Gruenbacher /* GETACL */
24363f8de37SChristoph Hellwig static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p)
244a257cdd0SAndreas Gruenbacher {
245f8cba473SChuck Lever 	struct xdr_stream *xdr = &rqstp->rq_res_stream;
24663f8de37SChristoph Hellwig 	struct nfsd3_getaclres *resp = rqstp->rq_resp;
247a257cdd0SAndreas Gruenbacher 	struct dentry *dentry = resp->fh.fh_dentry;
248aefa89d1SPrasad P 	struct inode *inode;
249cb65a5baSJesper Juhl 	int w;
250a257cdd0SAndreas Gruenbacher 
251f8cba473SChuck Lever 	if (!svcxdr_encode_stat(xdr, resp->status))
252a257cdd0SAndreas Gruenbacher 		return 0;
253f8cba473SChuck Lever 
254f8cba473SChuck Lever 	if (dentry == NULL || d_really_is_negative(dentry))
255f8cba473SChuck Lever 		return 1;
2562b0143b5SDavid Howells 	inode = d_inode(dentry);
257a257cdd0SAndreas Gruenbacher 
258f8cba473SChuck Lever 	if (!svcxdr_encode_fattr(rqstp, xdr, &resp->fh, &resp->stat))
259a257cdd0SAndreas Gruenbacher 		return 0;
260f8cba473SChuck Lever 	if (xdr_stream_encode_u32(xdr, resp->mask) < 0)
261f8cba473SChuck Lever 		return 0;
262a257cdd0SAndreas Gruenbacher 
263cb65a5baSJesper Juhl 	rqstp->rq_res.page_len = w = nfsacl_size(
264cb65a5baSJesper Juhl 		(resp->mask & NFS_ACL)   ? resp->acl_access  : NULL,
265cb65a5baSJesper Juhl 		(resp->mask & NFS_DFACL) ? resp->acl_default : NULL);
266a257cdd0SAndreas Gruenbacher 	while (w > 0) {
267afc59400SJ. Bruce Fields 		if (!*(rqstp->rq_next_page++))
268f8cba473SChuck Lever 			return 1;
269a257cdd0SAndreas Gruenbacher 		w -= PAGE_SIZE;
270a257cdd0SAndreas Gruenbacher 	}
271a257cdd0SAndreas Gruenbacher 
272f8cba473SChuck Lever 	if (!nfs_stream_encode_acl(xdr, inode, resp->acl_access,
273f8cba473SChuck Lever 				   resp->mask & NFS_ACL, 0))
274f8cba473SChuck Lever 		return 0;
275f8cba473SChuck Lever 	if (!nfs_stream_encode_acl(xdr, inode, resp->acl_default,
276f8cba473SChuck Lever 				   resp->mask & NFS_DFACL, NFS_ACL_DEFAULT))
277f8cba473SChuck Lever 		return 0;
278f8cba473SChuck Lever 
279f8cba473SChuck Lever 	return 1;
280a257cdd0SAndreas Gruenbacher }
281a257cdd0SAndreas Gruenbacher 
282a257cdd0SAndreas Gruenbacher /* ACCESS */
28363f8de37SChristoph Hellwig static int nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, __be32 *p)
284a257cdd0SAndreas Gruenbacher {
28563f8de37SChristoph Hellwig 	struct nfsd3_accessres *resp = rqstp->rq_resp;
28663f8de37SChristoph Hellwig 
287cc028a10SChuck Lever 	*p++ = resp->status;
288f0af2210SChuck Lever 	if (resp->status != nfs_ok)
289cc028a10SChuck Lever 		goto out;
290f0af2210SChuck Lever 
2914f4a4fadSJ. Bruce Fields 	p = nfs2svc_encode_fattr(rqstp, p, &resp->fh, &resp->stat);
292a257cdd0SAndreas Gruenbacher 	*p++ = htonl(resp->access);
293cc028a10SChuck Lever out:
294a257cdd0SAndreas Gruenbacher 	return xdr_ressize_check(rqstp, p);
295a257cdd0SAndreas Gruenbacher }
296a257cdd0SAndreas Gruenbacher 
297a257cdd0SAndreas Gruenbacher /*
298a257cdd0SAndreas Gruenbacher  * XDR release functions
299a257cdd0SAndreas Gruenbacher  */
3008537488bSChristoph Hellwig static void nfsaclsvc_release_getacl(struct svc_rqst *rqstp)
301a257cdd0SAndreas Gruenbacher {
3028537488bSChristoph Hellwig 	struct nfsd3_getaclres *resp = rqstp->rq_resp;
3038537488bSChristoph Hellwig 
304a257cdd0SAndreas Gruenbacher 	fh_put(&resp->fh);
305a257cdd0SAndreas Gruenbacher 	posix_acl_release(resp->acl_access);
306a257cdd0SAndreas Gruenbacher 	posix_acl_release(resp->acl_default);
307a257cdd0SAndreas Gruenbacher }
308a257cdd0SAndreas Gruenbacher 
3098537488bSChristoph Hellwig static void nfsaclsvc_release_access(struct svc_rqst *rqstp)
310a257cdd0SAndreas Gruenbacher {
3118537488bSChristoph Hellwig 	struct nfsd3_accessres *resp = rqstp->rq_resp;
3128537488bSChristoph Hellwig 
313a257cdd0SAndreas Gruenbacher 	fh_put(&resp->fh);
314a257cdd0SAndreas Gruenbacher }
315a257cdd0SAndreas Gruenbacher 
316a257cdd0SAndreas Gruenbacher struct nfsd3_voidargs { int dummy; };
317a257cdd0SAndreas Gruenbacher 
318a257cdd0SAndreas Gruenbacher #define ST 1		/* status*/
319a257cdd0SAndreas Gruenbacher #define AT 21		/* attributes */
320a257cdd0SAndreas Gruenbacher #define pAT (1+AT)	/* post attributes - conditional */
321a257cdd0SAndreas Gruenbacher #define ACL (1+NFS_ACL_MAX_ENTRIES*3)  /* Access Control List */
322a257cdd0SAndreas Gruenbacher 
323ba1df797SChuck Lever static const struct svc_procedure nfsd_acl_procedures2[5] = {
324ba1df797SChuck Lever 	[ACLPROC2_NULL] = {
325ba1df797SChuck Lever 		.pc_func = nfsacld_proc_null,
326788f7183SChuck Lever 		.pc_decode = nfssvc_decode_voidarg,
327788f7183SChuck Lever 		.pc_encode = nfssvc_encode_voidres,
328788f7183SChuck Lever 		.pc_argsize = sizeof(struct nfsd_voidargs),
329788f7183SChuck Lever 		.pc_ressize = sizeof(struct nfsd_voidres),
330ba1df797SChuck Lever 		.pc_cachetype = RC_NOCACHE,
331ba1df797SChuck Lever 		.pc_xdrressize = ST,
3322289e87bSChuck Lever 		.pc_name = "NULL",
333ba1df797SChuck Lever 	},
334ba1df797SChuck Lever 	[ACLPROC2_GETACL] = {
335ba1df797SChuck Lever 		.pc_func = nfsacld_proc_getacl,
336ba1df797SChuck Lever 		.pc_decode = nfsaclsvc_decode_getaclargs,
337ba1df797SChuck Lever 		.pc_encode = nfsaclsvc_encode_getaclres,
338ba1df797SChuck Lever 		.pc_release = nfsaclsvc_release_getacl,
339ba1df797SChuck Lever 		.pc_argsize = sizeof(struct nfsd3_getaclargs),
340ba1df797SChuck Lever 		.pc_ressize = sizeof(struct nfsd3_getaclres),
341ba1df797SChuck Lever 		.pc_cachetype = RC_NOCACHE,
342ba1df797SChuck Lever 		.pc_xdrressize = ST+1+2*(1+ACL),
3432289e87bSChuck Lever 		.pc_name = "GETACL",
344ba1df797SChuck Lever 	},
345ba1df797SChuck Lever 	[ACLPROC2_SETACL] = {
346ba1df797SChuck Lever 		.pc_func = nfsacld_proc_setacl,
347ba1df797SChuck Lever 		.pc_decode = nfsaclsvc_decode_setaclargs,
348778f068fSChuck Lever 		.pc_encode = nfssvc_encode_attrstatres,
349778f068fSChuck Lever 		.pc_release = nfssvc_release_attrstat,
350ba1df797SChuck Lever 		.pc_argsize = sizeof(struct nfsd3_setaclargs),
351ba1df797SChuck Lever 		.pc_ressize = sizeof(struct nfsd_attrstat),
352ba1df797SChuck Lever 		.pc_cachetype = RC_NOCACHE,
353ba1df797SChuck Lever 		.pc_xdrressize = ST+AT,
3542289e87bSChuck Lever 		.pc_name = "SETACL",
355ba1df797SChuck Lever 	},
356ba1df797SChuck Lever 	[ACLPROC2_GETATTR] = {
357ba1df797SChuck Lever 		.pc_func = nfsacld_proc_getattr,
358571d31f3SChuck Lever 		.pc_decode = nfssvc_decode_fhandleargs,
359*8d2009a1SChuck Lever 		.pc_encode = nfssvc_encode_attrstatres,
360*8d2009a1SChuck Lever 		.pc_release = nfssvc_release_attrstat,
361ba1df797SChuck Lever 		.pc_argsize = sizeof(struct nfsd_fhandle),
362ba1df797SChuck Lever 		.pc_ressize = sizeof(struct nfsd_attrstat),
363ba1df797SChuck Lever 		.pc_cachetype = RC_NOCACHE,
364ba1df797SChuck Lever 		.pc_xdrressize = ST+AT,
3652289e87bSChuck Lever 		.pc_name = "GETATTR",
366ba1df797SChuck Lever 	},
367ba1df797SChuck Lever 	[ACLPROC2_ACCESS] = {
368ba1df797SChuck Lever 		.pc_func = nfsacld_proc_access,
369ba1df797SChuck Lever 		.pc_decode = nfsaclsvc_decode_accessargs,
370ba1df797SChuck Lever 		.pc_encode = nfsaclsvc_encode_accessres,
371ba1df797SChuck Lever 		.pc_release = nfsaclsvc_release_access,
372ba1df797SChuck Lever 		.pc_argsize = 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 
3807fd38af9SChristoph Hellwig static unsigned int nfsd_acl_count2[ARRAY_SIZE(nfsd_acl_procedures2)];
381e9679189SChristoph Hellwig const struct svc_version nfsd_acl_version2 = {
382a257cdd0SAndreas Gruenbacher 	.vs_vers	= 2,
383a257cdd0SAndreas Gruenbacher 	.vs_nproc	= 5,
384a257cdd0SAndreas Gruenbacher 	.vs_proc	= nfsd_acl_procedures2,
3857fd38af9SChristoph Hellwig 	.vs_count	= nfsd_acl_count2,
386a257cdd0SAndreas Gruenbacher 	.vs_dispatch	= nfsd_dispatch,
387a257cdd0SAndreas Gruenbacher 	.vs_xdrsize	= NFS3_SVC_XDRSIZE,
388a257cdd0SAndreas Gruenbacher };
389