blob: 367551bddfc63e512d51d7b0012d6aa89cf2c570 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +00002/*
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +00003 * Process version 2 NFSACL requests.
4 *
5 * Copyright (C) 2002-2003 Andreas Gruenbacher <agruen@suse.de>
6 */
7
Boaz Harrosh9a74af22009-12-03 20:30:56 +02008#include "nfsd.h"
9/* FIXME: nfsacl.h is a broken header */
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +000010#include <linux/nfsacl.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090011#include <linux/gfp.h>
Boaz Harrosh9a74af22009-12-03 20:30:56 +020012#include "cache.h"
13#include "xdr3.h"
J. Bruce Fields0a3adad2009-11-04 18:12:35 -050014#include "vfs.h"
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +000015
16#define NFSDDBG_FACILITY NFSDDBG_PROC
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +000017
18/*
19 * NULL call.
20 */
Al Viro7111c662006-10-19 23:28:45 -070021static __be32
Christoph Hellwiga6beb732017-05-08 17:35:49 +020022nfsacld_proc_null(struct svc_rqst *rqstp)
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +000023{
Chuck Levercc028a12020-10-02 15:52:44 -040024 return rpc_success;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +000025}
26
27/*
28 * Get the Access and/or Default ACL of a file.
29 */
Christoph Hellwiga6beb732017-05-08 17:35:49 +020030static __be32 nfsacld_proc_getacl(struct svc_rqst *rqstp)
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +000031{
Christoph Hellwiga6beb732017-05-08 17:35:49 +020032 struct nfsd3_getaclargs *argp = rqstp->rq_argp;
33 struct nfsd3_getaclres *resp = rqstp->rq_resp;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +000034 struct posix_acl *acl;
Christoph Hellwig4ac72492013-12-20 05:16:55 -080035 struct inode *inode;
36 svc_fh *fh;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +000037
38 dprintk("nfsd: GETACL(2acl) %s\n", SVCFH_fmt(&argp->fh));
39
40 fh = fh_copy(&resp->fh, &argp->fh);
Chuck Leverf0af2212020-10-01 18:59:49 -040041 resp->status = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP);
42 if (resp->status != nfs_ok)
43 goto out;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +000044
David Howells2b0143b2015-03-17 22:25:59 +000045 inode = d_inode(fh->fh_dentry);
Christoph Hellwig4ac72492013-12-20 05:16:55 -080046
Chuck Leverf0af2212020-10-01 18:59:49 -040047 if (argp->mask & ~NFS_ACL_MASK) {
48 resp->status = nfserr_inval;
49 goto out;
50 }
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +000051 resp->mask = argp->mask;
52
Chuck Leverf0af2212020-10-01 18:59:49 -040053 resp->status = fh_getattr(fh, &resp->stat);
54 if (resp->status != nfs_ok)
55 goto out;
J. Bruce Fields4f4a4fa2013-02-01 15:13:04 -050056
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +000057 if (resp->mask & (NFS_ACL|NFS_ACLCNT)) {
Christoph Hellwig4ac72492013-12-20 05:16:55 -080058 acl = get_acl(inode, ACL_TYPE_ACCESS);
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +000059 if (acl == NULL) {
60 /* Solaris returns the inode's minimum ACL. */
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +000061 acl = posix_acl_from_mode(inode->i_mode, GFP_KERNEL);
62 }
Kinglong Mee35e634b2014-07-09 21:54:16 +080063 if (IS_ERR(acl)) {
Chuck Leverf0af2212020-10-01 18:59:49 -040064 resp->status = nfserrno(PTR_ERR(acl));
Kinglong Mee35e634b2014-07-09 21:54:16 +080065 goto fail;
66 }
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +000067 resp->acl_access = acl;
68 }
69 if (resp->mask & (NFS_DFACL|NFS_DFACLCNT)) {
70 /* Check how Solaris handles requests for the Default ACL
71 of a non-directory! */
Christoph Hellwig4ac72492013-12-20 05:16:55 -080072 acl = get_acl(inode, ACL_TYPE_DEFAULT);
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +000073 if (IS_ERR(acl)) {
Chuck Leverf0af2212020-10-01 18:59:49 -040074 resp->status = nfserrno(PTR_ERR(acl));
Christoph Hellwig4ac72492013-12-20 05:16:55 -080075 goto fail;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +000076 }
77 resp->acl_default = acl;
78 }
79
80 /* resp->acl_{access,default} are released in nfssvc_release_getacl. */
Chuck Leverf0af2212020-10-01 18:59:49 -040081out:
Chuck Levercc028a12020-10-02 15:52:44 -040082 return rpc_success;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +000083
84fail:
85 posix_acl_release(resp->acl_access);
86 posix_acl_release(resp->acl_default);
Chuck Leverf0af2212020-10-01 18:59:49 -040087 goto out;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +000088}
89
90/*
91 * Set the Access and/or Default ACL of a file.
92 */
Christoph Hellwiga6beb732017-05-08 17:35:49 +020093static __be32 nfsacld_proc_setacl(struct svc_rqst *rqstp)
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +000094{
Christoph Hellwiga6beb732017-05-08 17:35:49 +020095 struct nfsd3_setaclargs *argp = rqstp->rq_argp;
96 struct nfsd_attrstat *resp = rqstp->rq_resp;
Christoph Hellwig4ac72492013-12-20 05:16:55 -080097 struct inode *inode;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +000098 svc_fh *fh;
Christoph Hellwig4ac72492013-12-20 05:16:55 -080099 int error;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000100
101 dprintk("nfsd: SETACL(2acl) %s\n", SVCFH_fmt(&argp->fh));
102
103 fh = fh_copy(&resp->fh, &argp->fh);
Chuck Leverf0af2212020-10-01 18:59:49 -0400104 resp->status = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_SATTR);
105 if (resp->status != nfs_ok)
Christoph Hellwig4ac72492013-12-20 05:16:55 -0800106 goto out;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000107
David Howells2b0143b2015-03-17 22:25:59 +0000108 inode = d_inode(fh->fh_dentry);
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000109
Christoph Hellwig4ac72492013-12-20 05:16:55 -0800110 error = fh_want_write(fh);
111 if (error)
112 goto out_errno;
113
Ben Hutchings99965372016-06-22 19:43:35 +0100114 fh_lock(fh);
115
Christian Braunere65ce2a2021-01-21 14:19:27 +0100116 error = set_posix_acl(&init_user_ns, inode, ACL_TYPE_ACCESS,
117 argp->acl_access);
Christoph Hellwig4ac72492013-12-20 05:16:55 -0800118 if (error)
Ben Hutchings99965372016-06-22 19:43:35 +0100119 goto out_drop_lock;
Christian Braunere65ce2a2021-01-21 14:19:27 +0100120 error = set_posix_acl(&init_user_ns, inode, ACL_TYPE_DEFAULT,
121 argp->acl_default);
Christoph Hellwig4ac72492013-12-20 05:16:55 -0800122 if (error)
Ben Hutchings99965372016-06-22 19:43:35 +0100123 goto out_drop_lock;
124
125 fh_unlock(fh);
Christoph Hellwig4ac72492013-12-20 05:16:55 -0800126
127 fh_drop_write(fh);
128
Chuck Leverf0af2212020-10-01 18:59:49 -0400129 resp->status = fh_getattr(fh, &resp->stat);
Christoph Hellwig4ac72492013-12-20 05:16:55 -0800130
131out:
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000132 /* argp->acl_{access,default} may have been allocated in
133 nfssvc_decode_setaclargs. */
134 posix_acl_release(argp->acl_access);
135 posix_acl_release(argp->acl_default);
Chuck Levercc028a12020-10-02 15:52:44 -0400136 return rpc_success;
Chuck Leverf0af2212020-10-01 18:59:49 -0400137
Ben Hutchings99965372016-06-22 19:43:35 +0100138out_drop_lock:
139 fh_unlock(fh);
Christoph Hellwig4ac72492013-12-20 05:16:55 -0800140 fh_drop_write(fh);
141out_errno:
Chuck Leverf0af2212020-10-01 18:59:49 -0400142 resp->status = nfserrno(error);
Christoph Hellwig4ac72492013-12-20 05:16:55 -0800143 goto out;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000144}
145
146/*
147 * Check file attributes
148 */
Christoph Hellwiga6beb732017-05-08 17:35:49 +0200149static __be32 nfsacld_proc_getattr(struct svc_rqst *rqstp)
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000150{
Christoph Hellwiga6beb732017-05-08 17:35:49 +0200151 struct nfsd_fhandle *argp = rqstp->rq_argp;
152 struct nfsd_attrstat *resp = rqstp->rq_resp;
Chuck Leverf0af2212020-10-01 18:59:49 -0400153
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000154 dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh));
155
156 fh_copy(&resp->fh, &argp->fh);
Chuck Leverf0af2212020-10-01 18:59:49 -0400157 resp->status = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP);
158 if (resp->status != nfs_ok)
159 goto out;
160 resp->status = fh_getattr(&resp->fh, &resp->stat);
161out:
Chuck Levercc028a12020-10-02 15:52:44 -0400162 return rpc_success;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000163}
164
165/*
166 * Check file access
167 */
Christoph Hellwiga6beb732017-05-08 17:35:49 +0200168static __be32 nfsacld_proc_access(struct svc_rqst *rqstp)
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000169{
Christoph Hellwiga6beb732017-05-08 17:35:49 +0200170 struct nfsd3_accessargs *argp = rqstp->rq_argp;
171 struct nfsd3_accessres *resp = rqstp->rq_resp;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000172
173 dprintk("nfsd: ACCESS(2acl) %s 0x%x\n",
174 SVCFH_fmt(&argp->fh),
175 argp->access);
176
177 fh_copy(&resp->fh, &argp->fh);
178 resp->access = argp->access;
Chuck Leverf0af2212020-10-01 18:59:49 -0400179 resp->status = nfsd_access(rqstp, &resp->fh, &resp->access, NULL);
180 if (resp->status != nfs_ok)
181 goto out;
182 resp->status = fh_getattr(&resp->fh, &resp->stat);
183out:
Chuck Levercc028a12020-10-02 15:52:44 -0400184 return rpc_success;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000185}
186
187/*
188 * XDR decode functions
189 */
Chuck Leverdcc46992020-10-01 18:59:12 -0400190
Chuck Leverc44b31c2021-10-12 11:57:28 -0400191static bool
Chuck Lever16c66362021-10-12 11:57:22 -0400192nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000193{
Christoph Hellwig026fec72017-05-08 19:01:48 +0200194 struct nfsd3_getaclargs *argp = rqstp->rq_argp;
195
Chuck Lever635a45d2020-11-17 11:32:04 -0500196 if (!svcxdr_decode_fhandle(xdr, &argp->fh))
Chuck Leverc44b31c2021-10-12 11:57:28 -0400197 return false;
Chuck Lever635a45d2020-11-17 11:32:04 -0500198 if (xdr_stream_decode_u32(xdr, &argp->mask) < 0)
Chuck Leverc44b31c2021-10-12 11:57:28 -0400199 return false;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000200
Chuck Leverc44b31c2021-10-12 11:57:28 -0400201 return true;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000202}
203
Chuck Leverc44b31c2021-10-12 11:57:28 -0400204static bool
Chuck Lever16c66362021-10-12 11:57:22 -0400205nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000206{
Christoph Hellwig026fec72017-05-08 19:01:48 +0200207 struct nfsd3_setaclargs *argp = rqstp->rq_argp;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000208
Chuck Lever427eab32020-11-17 11:37:35 -0500209 if (!svcxdr_decode_fhandle(xdr, &argp->fh))
Chuck Leverc44b31c2021-10-12 11:57:28 -0400210 return false;
Chuck Lever427eab32020-11-17 11:37:35 -0500211 if (xdr_stream_decode_u32(xdr, &argp->mask) < 0)
Chuck Leverc44b31c2021-10-12 11:57:28 -0400212 return false;
Chuck Lever427eab32020-11-17 11:37:35 -0500213 if (argp->mask & ~NFS_ACL_MASK)
Chuck Leverc44b31c2021-10-12 11:57:28 -0400214 return false;
Chuck Lever427eab32020-11-17 11:37:35 -0500215 if (!nfs_stream_decode_acl(xdr, NULL, (argp->mask & NFS_ACL) ?
216 &argp->acl_access : NULL))
Chuck Leverc44b31c2021-10-12 11:57:28 -0400217 return false;
Chuck Lever427eab32020-11-17 11:37:35 -0500218 if (!nfs_stream_decode_acl(xdr, NULL, (argp->mask & NFS_DFACL) ?
219 &argp->acl_default : NULL))
Chuck Leverc44b31c2021-10-12 11:57:28 -0400220 return false;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000221
Chuck Leverc44b31c2021-10-12 11:57:28 -0400222 return true;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000223}
224
Chuck Leverc44b31c2021-10-12 11:57:28 -0400225static bool
Chuck Lever16c66362021-10-12 11:57:22 -0400226nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000227{
Chuck Lever64063892020-11-17 11:49:29 -0500228 struct nfsd3_accessargs *args = rqstp->rq_argp;
Christoph Hellwig026fec72017-05-08 19:01:48 +0200229
Chuck Lever64063892020-11-17 11:49:29 -0500230 if (!svcxdr_decode_fhandle(xdr, &args->fh))
Chuck Leverc44b31c2021-10-12 11:57:28 -0400231 return false;
Chuck Lever64063892020-11-17 11:49:29 -0500232 if (xdr_stream_decode_u32(xdr, &args->access) < 0)
Chuck Leverc44b31c2021-10-12 11:57:28 -0400233 return false;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000234
Chuck Leverc44b31c2021-10-12 11:57:28 -0400235 return true;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000236}
237
238/*
239 * XDR encode functions
240 */
241
242/* GETACL */
Chuck Lever130e2052021-10-13 10:41:13 -0400243static bool
Chuck Leverfda49442021-10-13 10:41:06 -0400244nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000245{
Christoph Hellwig63f8de32017-05-08 19:42:02 +0200246 struct nfsd3_getaclres *resp = rqstp->rq_resp;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000247 struct dentry *dentry = resp->fh.fh_dentry;
Prasad Paefa89d2007-10-24 15:14:32 -0500248 struct inode *inode;
Jesper Juhlcb65a5b2006-12-08 02:39:39 -0800249 int w;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000250
Chuck Leverf8cba472020-11-18 14:38:47 -0500251 if (!svcxdr_encode_stat(xdr, resp->status))
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000252 return 0;
Chuck Leverf8cba472020-11-18 14:38:47 -0500253
254 if (dentry == NULL || d_really_is_negative(dentry))
255 return 1;
David Howells2b0143b2015-03-17 22:25:59 +0000256 inode = d_inode(dentry);
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000257
Chuck Leverf8cba472020-11-18 14:38:47 -0500258 if (!svcxdr_encode_fattr(rqstp, xdr, &resp->fh, &resp->stat))
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000259 return 0;
Chuck Leverf8cba472020-11-18 14:38:47 -0500260 if (xdr_stream_encode_u32(xdr, resp->mask) < 0)
261 return 0;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000262
Jesper Juhlcb65a5b2006-12-08 02:39:39 -0800263 rqstp->rq_res.page_len = w = nfsacl_size(
264 (resp->mask & NFS_ACL) ? resp->acl_access : NULL,
265 (resp->mask & NFS_DFACL) ? resp->acl_default : NULL);
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000266 while (w > 0) {
J. Bruce Fieldsafc59402012-12-10 18:01:37 -0500267 if (!*(rqstp->rq_next_page++))
Chuck Leverf8cba472020-11-18 14:38:47 -0500268 return 1;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000269 w -= PAGE_SIZE;
270 }
271
Chuck Leverf8cba472020-11-18 14:38:47 -0500272 if (!nfs_stream_encode_acl(xdr, inode, resp->acl_access,
273 resp->mask & NFS_ACL, 0))
274 return 0;
275 if (!nfs_stream_encode_acl(xdr, inode, resp->acl_default,
276 resp->mask & NFS_DFACL, NFS_ACL_DEFAULT))
277 return 0;
278
279 return 1;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000280}
281
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000282/* ACCESS */
Chuck Lever130e2052021-10-13 10:41:13 -0400283static bool
Chuck Leverfda49442021-10-13 10:41:06 -0400284nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000285{
Christoph Hellwig63f8de32017-05-08 19:42:02 +0200286 struct nfsd3_accessres *resp = rqstp->rq_resp;
287
Chuck Lever07f5c292020-11-18 14:52:09 -0500288 if (!svcxdr_encode_stat(xdr, resp->status))
289 return 0;
290 switch (resp->status) {
291 case nfs_ok:
292 if (!svcxdr_encode_fattr(rqstp, xdr, &resp->fh, &resp->stat))
293 return 0;
294 if (xdr_stream_encode_u32(xdr, resp->access) < 0)
295 return 0;
296 break;
297 }
Chuck Leverf0af2212020-10-01 18:59:49 -0400298
Chuck Lever07f5c292020-11-18 14:52:09 -0500299 return 1;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000300}
301
302/*
303 * XDR release functions
304 */
Christoph Hellwig85374882017-05-08 18:48:24 +0200305static void nfsaclsvc_release_getacl(struct svc_rqst *rqstp)
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000306{
Christoph Hellwig85374882017-05-08 18:48:24 +0200307 struct nfsd3_getaclres *resp = rqstp->rq_resp;
308
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000309 fh_put(&resp->fh);
310 posix_acl_release(resp->acl_access);
311 posix_acl_release(resp->acl_default);
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000312}
313
Christoph Hellwig85374882017-05-08 18:48:24 +0200314static void nfsaclsvc_release_access(struct svc_rqst *rqstp)
Greg Banksc9ce2282007-02-20 10:12:34 +1100315{
Christoph Hellwig85374882017-05-08 18:48:24 +0200316 struct nfsd3_accessres *resp = rqstp->rq_resp;
317
318 fh_put(&resp->fh);
Greg Banksc9ce2282007-02-20 10:12:34 +1100319}
320
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000321struct nfsd3_voidargs { int dummy; };
322
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000323#define ST 1 /* status*/
324#define AT 21 /* attributes */
325#define pAT (1+AT) /* post attributes - conditional */
326#define ACL (1+NFS_ACL_MAX_ENTRIES*3) /* Access Control List */
327
Chuck Leverba1df792020-10-01 18:59:07 -0400328static const struct svc_procedure nfsd_acl_procedures2[5] = {
329 [ACLPROC2_NULL] = {
330 .pc_func = nfsacld_proc_null,
Chuck Lever788f7182020-11-05 14:48:29 -0500331 .pc_decode = nfssvc_decode_voidarg,
332 .pc_encode = nfssvc_encode_voidres,
333 .pc_argsize = sizeof(struct nfsd_voidargs),
334 .pc_ressize = sizeof(struct nfsd_voidres),
Chuck Leverba1df792020-10-01 18:59:07 -0400335 .pc_cachetype = RC_NOCACHE,
336 .pc_xdrressize = ST,
Chuck Lever2289e872020-09-17 17:22:49 -0400337 .pc_name = "NULL",
Chuck Leverba1df792020-10-01 18:59:07 -0400338 },
339 [ACLPROC2_GETACL] = {
340 .pc_func = nfsacld_proc_getacl,
341 .pc_decode = nfsaclsvc_decode_getaclargs,
342 .pc_encode = nfsaclsvc_encode_getaclres,
343 .pc_release = nfsaclsvc_release_getacl,
344 .pc_argsize = sizeof(struct nfsd3_getaclargs),
345 .pc_ressize = sizeof(struct nfsd3_getaclres),
346 .pc_cachetype = RC_NOCACHE,
347 .pc_xdrressize = ST+1+2*(1+ACL),
Chuck Lever2289e872020-09-17 17:22:49 -0400348 .pc_name = "GETACL",
Chuck Leverba1df792020-10-01 18:59:07 -0400349 },
350 [ACLPROC2_SETACL] = {
351 .pc_func = nfsacld_proc_setacl,
352 .pc_decode = nfsaclsvc_decode_setaclargs,
Chuck Lever778f0682020-11-18 14:47:56 -0500353 .pc_encode = nfssvc_encode_attrstatres,
354 .pc_release = nfssvc_release_attrstat,
Chuck Leverba1df792020-10-01 18:59:07 -0400355 .pc_argsize = sizeof(struct nfsd3_setaclargs),
356 .pc_ressize = sizeof(struct nfsd_attrstat),
357 .pc_cachetype = RC_NOCACHE,
358 .pc_xdrressize = ST+AT,
Chuck Lever2289e872020-09-17 17:22:49 -0400359 .pc_name = "SETACL",
Chuck Leverba1df792020-10-01 18:59:07 -0400360 },
361 [ACLPROC2_GETATTR] = {
362 .pc_func = nfsacld_proc_getattr,
Chuck Lever571d31f2020-11-17 11:46:50 -0500363 .pc_decode = nfssvc_decode_fhandleargs,
Chuck Lever8d2009a2020-11-18 14:49:57 -0500364 .pc_encode = nfssvc_encode_attrstatres,
365 .pc_release = nfssvc_release_attrstat,
Chuck Leverba1df792020-10-01 18:59:07 -0400366 .pc_argsize = sizeof(struct nfsd_fhandle),
367 .pc_ressize = sizeof(struct nfsd_attrstat),
368 .pc_cachetype = RC_NOCACHE,
369 .pc_xdrressize = ST+AT,
Chuck Lever2289e872020-09-17 17:22:49 -0400370 .pc_name = "GETATTR",
Chuck Leverba1df792020-10-01 18:59:07 -0400371 },
372 [ACLPROC2_ACCESS] = {
373 .pc_func = nfsacld_proc_access,
374 .pc_decode = nfsaclsvc_decode_accessargs,
375 .pc_encode = nfsaclsvc_encode_accessres,
376 .pc_release = nfsaclsvc_release_access,
377 .pc_argsize = sizeof(struct nfsd3_accessargs),
378 .pc_ressize = sizeof(struct nfsd3_accessres),
379 .pc_cachetype = RC_NOCACHE,
380 .pc_xdrressize = ST+AT+1,
Chuck Lever2289e872020-09-17 17:22:49 -0400381 .pc_name = "SETATTR",
Chuck Leverba1df792020-10-01 18:59:07 -0400382 },
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000383};
384
Christoph Hellwig7fd38af2017-05-08 23:40:27 +0200385static unsigned int nfsd_acl_count2[ARRAY_SIZE(nfsd_acl_procedures2)];
Christoph Hellwige9679182017-05-12 16:21:37 +0200386const struct svc_version nfsd_acl_version2 = {
387 .vs_vers = 2,
388 .vs_nproc = 5,
389 .vs_proc = nfsd_acl_procedures2,
390 .vs_count = nfsd_acl_count2,
391 .vs_dispatch = nfsd_dispatch,
392 .vs_xdrsize = NFS3_SVC_XDRSIZE,
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000393};