1 // SPDX-License-Identifier: GPL-2.0
3 * Process version 3 NFS requests.
9 #include <linux/ext2_fs.h>
10 #include <linux/magic.h>
16 #define NFSDDBG_FACILITY NFSDDBG_PROC
18 static int nfs3_ftypes[] = {
25 S_IFSOCK, /* NF3SOCK */
26 S_IFIFO, /* NF3FIFO */
33 nfsd3_proc_null(struct svc_rqst *rqstp)
39 * Get a file's attributes
42 nfsd3_proc_getattr(struct svc_rqst *rqstp)
44 struct nfsd_fhandle *argp = rqstp->rq_argp;
45 struct nfsd3_attrstat *resp = rqstp->rq_resp;
47 dprintk("nfsd: GETATTR(3) %s\n",
48 SVCFH_fmt(&argp->fh));
50 fh_copy(&resp->fh, &argp->fh);
51 resp->status = fh_verify(rqstp, &resp->fh, 0,
52 NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT);
53 if (resp->status != nfs_ok)
56 resp->status = fh_getattr(&resp->fh, &resp->stat);
62 * Set a file's attributes
65 nfsd3_proc_setattr(struct svc_rqst *rqstp)
67 struct nfsd3_sattrargs *argp = rqstp->rq_argp;
68 struct nfsd3_attrstat *resp = rqstp->rq_resp;
70 dprintk("nfsd: SETATTR(3) %s\n",
71 SVCFH_fmt(&argp->fh));
73 fh_copy(&resp->fh, &argp->fh);
74 resp->status = nfsd_setattr(rqstp, &resp->fh, &argp->attrs,
75 argp->check_guard, argp->guardtime);
80 * Look up a path name component
83 nfsd3_proc_lookup(struct svc_rqst *rqstp)
85 struct nfsd3_diropargs *argp = rqstp->rq_argp;
86 struct nfsd3_diropres *resp = rqstp->rq_resp;
88 dprintk("nfsd: LOOKUP(3) %s %.*s\n",
93 fh_copy(&resp->dirfh, &argp->fh);
94 fh_init(&resp->fh, NFS3_FHSIZE);
96 resp->status = nfsd_lookup(rqstp, &resp->dirfh,
97 argp->name, argp->len,
106 nfsd3_proc_access(struct svc_rqst *rqstp)
108 struct nfsd3_accessargs *argp = rqstp->rq_argp;
109 struct nfsd3_accessres *resp = rqstp->rq_resp;
111 dprintk("nfsd: ACCESS(3) %s 0x%x\n",
112 SVCFH_fmt(&argp->fh),
115 fh_copy(&resp->fh, &argp->fh);
116 resp->access = argp->access;
117 resp->status = nfsd_access(rqstp, &resp->fh, &resp->access, NULL);
125 nfsd3_proc_readlink(struct svc_rqst *rqstp)
127 struct nfsd_fhandle *argp = rqstp->rq_argp;
128 struct nfsd3_readlinkres *resp = rqstp->rq_resp;
130 dprintk("nfsd: READLINK(3) %s\n", SVCFH_fmt(&argp->fh));
132 /* Read the symlink. */
133 fh_copy(&resp->fh, &argp->fh);
134 resp->len = NFS3_MAXPATHLEN;
135 resp->pages = rqstp->rq_next_page++;
136 resp->status = nfsd_readlink(rqstp, &resp->fh,
137 page_address(*resp->pages), &resp->len);
142 * Read a portion of a file.
145 nfsd3_proc_read(struct svc_rqst *rqstp)
147 struct nfsd3_readargs *argp = rqstp->rq_argp;
148 struct nfsd3_readres *resp = rqstp->rq_resp;
149 u32 max_blocksize = svc_max_payload(rqstp);
153 argp->count = min_t(u32, argp->count, max_blocksize);
155 dprintk("nfsd: READ(3) %s %lu bytes at %Lu\n",
156 SVCFH_fmt(&argp->fh),
157 (unsigned long) argp->count,
158 (unsigned long long) argp->offset);
162 resp->pages = rqstp->rq_next_page;
164 struct page *page = *(rqstp->rq_next_page++);
166 rqstp->rq_vec[v].iov_base = page_address(page);
167 rqstp->rq_vec[v].iov_len = min_t(unsigned int, len, PAGE_SIZE);
168 len -= rqstp->rq_vec[v].iov_len;
172 /* Obtain buffer pointer for payload.
173 * 1 (status) + 22 (post_op_attr) + 1 (count) + 1 (eof)
174 * + 1 (xdr opaque byte count) = 26
176 resp->count = argp->count;
177 svc_reserve_auth(rqstp, ((1 + NFS3_POST_OP_ATTR_WORDS + 3)<<2) + resp->count +4);
179 fh_copy(&resp->fh, &argp->fh);
180 resp->status = nfsd_read(rqstp, &resp->fh, argp->offset,
181 rqstp->rq_vec, v, &resp->count, &resp->eof);
186 * Write data to a file
189 nfsd3_proc_write(struct svc_rqst *rqstp)
191 struct nfsd3_writeargs *argp = rqstp->rq_argp;
192 struct nfsd3_writeres *resp = rqstp->rq_resp;
193 unsigned long cnt = argp->len;
196 dprintk("nfsd: WRITE(3) %s %d bytes at %Lu%s\n",
197 SVCFH_fmt(&argp->fh),
199 (unsigned long long) argp->offset,
200 argp->stable? " stable" : "");
202 fh_copy(&resp->fh, &argp->fh);
203 resp->committed = argp->stable;
204 nvecs = svc_fill_write_vector(rqstp, &argp->payload);
206 resp->status = nfsd_write(rqstp, &resp->fh, argp->offset,
207 rqstp->rq_vec, nvecs, &cnt,
208 resp->committed, resp->verf);
214 * With NFSv3, CREATE processing is a lot easier than with NFSv2.
215 * At least in theory; we'll see how it fares in practice when the
216 * first reports about SunOS compatibility problems start to pour in...
219 nfsd3_proc_create(struct svc_rqst *rqstp)
221 struct nfsd3_createargs *argp = rqstp->rq_argp;
222 struct nfsd3_diropres *resp = rqstp->rq_resp;
223 svc_fh *dirfhp, *newfhp = NULL;
226 dprintk("nfsd: CREATE(3) %s %.*s\n",
227 SVCFH_fmt(&argp->fh),
231 dirfhp = fh_copy(&resp->dirfh, &argp->fh);
232 newfhp = fh_init(&resp->fh, NFS3_FHSIZE);
235 /* Unfudge the mode bits */
236 attr->ia_mode &= ~S_IFMT;
237 if (!(attr->ia_valid & ATTR_MODE)) {
238 attr->ia_valid |= ATTR_MODE;
239 attr->ia_mode = S_IFREG;
241 attr->ia_mode = (attr->ia_mode & ~S_IFMT) | S_IFREG;
244 /* Now create the file and set attributes */
245 resp->status = do_nfsd_create(rqstp, dirfhp, argp->name, argp->len,
246 attr, newfhp, argp->createmode,
247 (u32 *)argp->verf, NULL, NULL);
252 * Make directory. This operation is not idempotent.
255 nfsd3_proc_mkdir(struct svc_rqst *rqstp)
257 struct nfsd3_createargs *argp = rqstp->rq_argp;
258 struct nfsd3_diropres *resp = rqstp->rq_resp;
260 dprintk("nfsd: MKDIR(3) %s %.*s\n",
261 SVCFH_fmt(&argp->fh),
265 argp->attrs.ia_valid &= ~ATTR_SIZE;
266 fh_copy(&resp->dirfh, &argp->fh);
267 fh_init(&resp->fh, NFS3_FHSIZE);
268 resp->status = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
269 &argp->attrs, S_IFDIR, 0, &resp->fh);
270 fh_unlock(&resp->dirfh);
275 nfsd3_proc_symlink(struct svc_rqst *rqstp)
277 struct nfsd3_symlinkargs *argp = rqstp->rq_argp;
278 struct nfsd3_diropres *resp = rqstp->rq_resp;
280 if (argp->tlen == 0) {
281 resp->status = nfserr_inval;
284 if (argp->tlen > NFS3_MAXPATHLEN) {
285 resp->status = nfserr_nametoolong;
289 argp->tname = svc_fill_symlink_pathname(rqstp, &argp->first,
290 page_address(rqstp->rq_arg.pages[0]),
292 if (IS_ERR(argp->tname)) {
293 resp->status = nfserrno(PTR_ERR(argp->tname));
297 dprintk("nfsd: SYMLINK(3) %s %.*s -> %.*s\n",
298 SVCFH_fmt(&argp->ffh),
299 argp->flen, argp->fname,
300 argp->tlen, argp->tname);
302 fh_copy(&resp->dirfh, &argp->ffh);
303 fh_init(&resp->fh, NFS3_FHSIZE);
304 resp->status = nfsd_symlink(rqstp, &resp->dirfh, argp->fname,
305 argp->flen, argp->tname, &resp->fh);
312 * Make socket/fifo/device.
315 nfsd3_proc_mknod(struct svc_rqst *rqstp)
317 struct nfsd3_mknodargs *argp = rqstp->rq_argp;
318 struct nfsd3_diropres *resp = rqstp->rq_resp;
322 dprintk("nfsd: MKNOD(3) %s %.*s\n",
323 SVCFH_fmt(&argp->fh),
327 fh_copy(&resp->dirfh, &argp->fh);
328 fh_init(&resp->fh, NFS3_FHSIZE);
330 if (argp->ftype == NF3CHR || argp->ftype == NF3BLK) {
331 rdev = MKDEV(argp->major, argp->minor);
332 if (MAJOR(rdev) != argp->major ||
333 MINOR(rdev) != argp->minor) {
334 resp->status = nfserr_inval;
337 } else if (argp->ftype != NF3SOCK && argp->ftype != NF3FIFO) {
338 resp->status = nfserr_badtype;
342 type = nfs3_ftypes[argp->ftype];
343 resp->status = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
344 &argp->attrs, type, rdev, &resp->fh);
345 fh_unlock(&resp->dirfh);
351 * Remove file/fifo/socket etc.
354 nfsd3_proc_remove(struct svc_rqst *rqstp)
356 struct nfsd3_diropargs *argp = rqstp->rq_argp;
357 struct nfsd3_attrstat *resp = rqstp->rq_resp;
359 dprintk("nfsd: REMOVE(3) %s %.*s\n",
360 SVCFH_fmt(&argp->fh),
364 /* Unlink. -S_IFDIR means file must not be a directory */
365 fh_copy(&resp->fh, &argp->fh);
366 resp->status = nfsd_unlink(rqstp, &resp->fh, -S_IFDIR,
367 argp->name, argp->len);
368 fh_unlock(&resp->fh);
376 nfsd3_proc_rmdir(struct svc_rqst *rqstp)
378 struct nfsd3_diropargs *argp = rqstp->rq_argp;
379 struct nfsd3_attrstat *resp = rqstp->rq_resp;
381 dprintk("nfsd: RMDIR(3) %s %.*s\n",
382 SVCFH_fmt(&argp->fh),
386 fh_copy(&resp->fh, &argp->fh);
387 resp->status = nfsd_unlink(rqstp, &resp->fh, S_IFDIR,
388 argp->name, argp->len);
389 fh_unlock(&resp->fh);
394 nfsd3_proc_rename(struct svc_rqst *rqstp)
396 struct nfsd3_renameargs *argp = rqstp->rq_argp;
397 struct nfsd3_renameres *resp = rqstp->rq_resp;
399 dprintk("nfsd: RENAME(3) %s %.*s ->\n",
400 SVCFH_fmt(&argp->ffh),
403 dprintk("nfsd: -> %s %.*s\n",
404 SVCFH_fmt(&argp->tfh),
408 fh_copy(&resp->ffh, &argp->ffh);
409 fh_copy(&resp->tfh, &argp->tfh);
410 resp->status = nfsd_rename(rqstp, &resp->ffh, argp->fname, argp->flen,
411 &resp->tfh, argp->tname, argp->tlen);
416 nfsd3_proc_link(struct svc_rqst *rqstp)
418 struct nfsd3_linkargs *argp = rqstp->rq_argp;
419 struct nfsd3_linkres *resp = rqstp->rq_resp;
421 dprintk("nfsd: LINK(3) %s ->\n",
422 SVCFH_fmt(&argp->ffh));
423 dprintk("nfsd: -> %s %.*s\n",
424 SVCFH_fmt(&argp->tfh),
428 fh_copy(&resp->fh, &argp->ffh);
429 fh_copy(&resp->tfh, &argp->tfh);
430 resp->status = nfsd_link(rqstp, &resp->tfh, argp->tname, argp->tlen,
435 static void nfsd3_init_dirlist_pages(struct svc_rqst *rqstp,
436 struct nfsd3_readdirres *resp,
439 struct xdr_buf *buf = &resp->dirlist;
440 struct xdr_stream *xdr = &resp->xdr;
442 count = clamp(count, (u32)(XDR_UNIT * 2), svc_max_payload(rqstp));
444 memset(buf, 0, sizeof(*buf));
446 /* Reserve room for the NULL ptr & eof flag (-2 words) */
447 buf->buflen = count - XDR_UNIT * 2;
448 buf->pages = rqstp->rq_next_page;
449 rqstp->rq_next_page += (buf->buflen + PAGE_SIZE - 1) >> PAGE_SHIFT;
451 /* This is xdr_init_encode(), but it assumes that
452 * the head kvec has already been consumed. */
453 xdr_set_scratch_buffer(xdr, NULL, 0);
455 xdr->page_ptr = buf->pages;
457 xdr->p = page_address(*buf->pages);
458 xdr->end = (void *)xdr->p + min_t(u32, buf->buflen, PAGE_SIZE);
463 * Read a portion of a directory.
466 nfsd3_proc_readdir(struct svc_rqst *rqstp)
468 struct nfsd3_readdirargs *argp = rqstp->rq_argp;
469 struct nfsd3_readdirres *resp = rqstp->rq_resp;
472 dprintk("nfsd: READDIR(3) %s %d bytes at %d\n",
473 SVCFH_fmt(&argp->fh),
474 argp->count, (u32) argp->cookie);
476 nfsd3_init_dirlist_pages(rqstp, resp, argp->count);
478 fh_copy(&resp->fh, &argp->fh);
479 resp->common.err = nfs_ok;
480 resp->cookie_offset = 0;
482 offset = argp->cookie;
483 resp->status = nfsd_readdir(rqstp, &resp->fh, &offset,
484 &resp->common, nfs3svc_encode_entry3);
485 memcpy(resp->verf, argp->verf, 8);
486 nfs3svc_encode_cookie3(resp, offset);
488 /* Recycle only pages that were part of the reply */
489 rqstp->rq_next_page = resp->xdr.page_ptr + 1;
495 * Read a portion of a directory, including file handles and attrs.
496 * For now, we choose to ignore the dircount parameter.
499 nfsd3_proc_readdirplus(struct svc_rqst *rqstp)
501 struct nfsd3_readdirargs *argp = rqstp->rq_argp;
502 struct nfsd3_readdirres *resp = rqstp->rq_resp;
505 dprintk("nfsd: READDIR+(3) %s %d bytes at %d\n",
506 SVCFH_fmt(&argp->fh),
507 argp->count, (u32) argp->cookie);
509 nfsd3_init_dirlist_pages(rqstp, resp, argp->count);
511 fh_copy(&resp->fh, &argp->fh);
512 resp->common.err = nfs_ok;
513 resp->cookie_offset = 0;
515 offset = argp->cookie;
517 resp->status = fh_verify(rqstp, &resp->fh, S_IFDIR, NFSD_MAY_NOP);
518 if (resp->status != nfs_ok)
521 if (resp->fh.fh_export->ex_flags & NFSEXP_NOREADDIRPLUS) {
522 resp->status = nfserr_notsupp;
526 resp->status = nfsd_readdir(rqstp, &resp->fh, &offset,
527 &resp->common, nfs3svc_encode_entryplus3);
528 memcpy(resp->verf, argp->verf, 8);
529 nfs3svc_encode_cookie3(resp, offset);
531 /* Recycle only pages that were part of the reply */
532 rqstp->rq_next_page = resp->xdr.page_ptr + 1;
539 * Get file system stats
542 nfsd3_proc_fsstat(struct svc_rqst *rqstp)
544 struct nfsd_fhandle *argp = rqstp->rq_argp;
545 struct nfsd3_fsstatres *resp = rqstp->rq_resp;
547 dprintk("nfsd: FSSTAT(3) %s\n",
548 SVCFH_fmt(&argp->fh));
550 resp->status = nfsd_statfs(rqstp, &argp->fh, &resp->stats, 0);
556 * Get file system info
559 nfsd3_proc_fsinfo(struct svc_rqst *rqstp)
561 struct nfsd_fhandle *argp = rqstp->rq_argp;
562 struct nfsd3_fsinfores *resp = rqstp->rq_resp;
563 u32 max_blocksize = svc_max_payload(rqstp);
565 dprintk("nfsd: FSINFO(3) %s\n",
566 SVCFH_fmt(&argp->fh));
568 resp->f_rtmax = max_blocksize;
569 resp->f_rtpref = max_blocksize;
570 resp->f_rtmult = PAGE_SIZE;
571 resp->f_wtmax = max_blocksize;
572 resp->f_wtpref = max_blocksize;
573 resp->f_wtmult = PAGE_SIZE;
574 resp->f_dtpref = max_blocksize;
575 resp->f_maxfilesize = ~(u32) 0;
576 resp->f_properties = NFS3_FSF_DEFAULT;
578 resp->status = fh_verify(rqstp, &argp->fh, 0,
579 NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT);
581 /* Check special features of the file system. May request
582 * different read/write sizes for file systems known to have
583 * problems with large blocks */
584 if (resp->status == nfs_ok) {
585 struct super_block *sb = argp->fh.fh_dentry->d_sb;
587 /* Note that we don't care for remote fs's here */
588 if (sb->s_magic == MSDOS_SUPER_MAGIC) {
589 resp->f_properties = NFS3_FSF_BILLYBOY;
591 resp->f_maxfilesize = sb->s_maxbytes;
599 * Get pathconf info for the specified file
602 nfsd3_proc_pathconf(struct svc_rqst *rqstp)
604 struct nfsd_fhandle *argp = rqstp->rq_argp;
605 struct nfsd3_pathconfres *resp = rqstp->rq_resp;
607 dprintk("nfsd: PATHCONF(3) %s\n",
608 SVCFH_fmt(&argp->fh));
610 /* Set default pathconf */
611 resp->p_link_max = 255; /* at least */
612 resp->p_name_max = 255; /* at least */
613 resp->p_no_trunc = 0;
614 resp->p_chown_restricted = 1;
615 resp->p_case_insensitive = 0;
616 resp->p_case_preserving = 1;
618 resp->status = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP);
620 if (resp->status == nfs_ok) {
621 struct super_block *sb = argp->fh.fh_dentry->d_sb;
623 /* Note that we don't care for remote fs's here */
624 switch (sb->s_magic) {
625 case EXT2_SUPER_MAGIC:
626 resp->p_link_max = EXT2_LINK_MAX;
627 resp->p_name_max = EXT2_NAME_LEN;
629 case MSDOS_SUPER_MAGIC:
630 resp->p_case_insensitive = 1;
631 resp->p_case_preserving = 0;
641 * Commit a file (range) to stable storage.
644 nfsd3_proc_commit(struct svc_rqst *rqstp)
646 struct nfsd3_commitargs *argp = rqstp->rq_argp;
647 struct nfsd3_commitres *resp = rqstp->rq_resp;
649 dprintk("nfsd: COMMIT(3) %s %u@%Lu\n",
650 SVCFH_fmt(&argp->fh),
652 (unsigned long long) argp->offset);
654 if (argp->offset > NFS_OFFSET_MAX) {
655 resp->status = nfserr_inval;
659 fh_copy(&resp->fh, &argp->fh);
660 resp->status = nfsd_commit(rqstp, &resp->fh, argp->offset,
661 argp->count, resp->verf);
668 * NFSv3 Server procedures.
669 * Only the results of non-idempotent operations are cached.
671 #define nfs3svc_encode_attrstatres nfs3svc_encode_attrstat
672 #define nfs3svc_encode_wccstatres nfs3svc_encode_wccstat
673 #define nfsd3_mkdirargs nfsd3_createargs
674 #define nfsd3_readdirplusargs nfsd3_readdirargs
675 #define nfsd3_fhandleargs nfsd_fhandle
676 #define nfsd3_attrstatres nfsd3_attrstat
677 #define nfsd3_wccstatres nfsd3_attrstat
678 #define nfsd3_createres nfsd3_diropres
680 #define ST 1 /* status*/
681 #define FH 17 /* filehandle with length */
682 #define AT 21 /* attributes */
683 #define pAT (1+AT) /* post attributes - conditional */
684 #define WC (7+pAT) /* WCC attributes */
686 static const struct svc_procedure nfsd_procedures3[22] = {
688 .pc_func = nfsd3_proc_null,
689 .pc_decode = nfssvc_decode_voidarg,
690 .pc_encode = nfssvc_encode_voidres,
691 .pc_argsize = sizeof(struct nfsd_voidargs),
692 .pc_ressize = sizeof(struct nfsd_voidres),
693 .pc_cachetype = RC_NOCACHE,
697 [NFS3PROC_GETATTR] = {
698 .pc_func = nfsd3_proc_getattr,
699 .pc_decode = nfs3svc_decode_fhandleargs,
700 .pc_encode = nfs3svc_encode_getattrres,
701 .pc_release = nfs3svc_release_fhandle,
702 .pc_argsize = sizeof(struct nfsd_fhandle),
703 .pc_ressize = sizeof(struct nfsd3_attrstatres),
704 .pc_cachetype = RC_NOCACHE,
705 .pc_xdrressize = ST+AT,
706 .pc_name = "GETATTR",
708 [NFS3PROC_SETATTR] = {
709 .pc_func = nfsd3_proc_setattr,
710 .pc_decode = nfs3svc_decode_sattrargs,
711 .pc_encode = nfs3svc_encode_wccstatres,
712 .pc_release = nfs3svc_release_fhandle,
713 .pc_argsize = sizeof(struct nfsd3_sattrargs),
714 .pc_ressize = sizeof(struct nfsd3_wccstatres),
715 .pc_cachetype = RC_REPLBUFF,
716 .pc_xdrressize = ST+WC,
717 .pc_name = "SETATTR",
719 [NFS3PROC_LOOKUP] = {
720 .pc_func = nfsd3_proc_lookup,
721 .pc_decode = nfs3svc_decode_diropargs,
722 .pc_encode = nfs3svc_encode_lookupres,
723 .pc_release = nfs3svc_release_fhandle2,
724 .pc_argsize = sizeof(struct nfsd3_diropargs),
725 .pc_ressize = sizeof(struct nfsd3_diropres),
726 .pc_cachetype = RC_NOCACHE,
727 .pc_xdrressize = ST+FH+pAT+pAT,
730 [NFS3PROC_ACCESS] = {
731 .pc_func = nfsd3_proc_access,
732 .pc_decode = nfs3svc_decode_accessargs,
733 .pc_encode = nfs3svc_encode_accessres,
734 .pc_release = nfs3svc_release_fhandle,
735 .pc_argsize = sizeof(struct nfsd3_accessargs),
736 .pc_ressize = sizeof(struct nfsd3_accessres),
737 .pc_cachetype = RC_NOCACHE,
738 .pc_xdrressize = ST+pAT+1,
741 [NFS3PROC_READLINK] = {
742 .pc_func = nfsd3_proc_readlink,
743 .pc_decode = nfs3svc_decode_fhandleargs,
744 .pc_encode = nfs3svc_encode_readlinkres,
745 .pc_release = nfs3svc_release_fhandle,
746 .pc_argsize = sizeof(struct nfsd_fhandle),
747 .pc_ressize = sizeof(struct nfsd3_readlinkres),
748 .pc_cachetype = RC_NOCACHE,
749 .pc_xdrressize = ST+pAT+1+NFS3_MAXPATHLEN/4,
750 .pc_name = "READLINK",
753 .pc_func = nfsd3_proc_read,
754 .pc_decode = nfs3svc_decode_readargs,
755 .pc_encode = nfs3svc_encode_readres,
756 .pc_release = nfs3svc_release_fhandle,
757 .pc_argsize = sizeof(struct nfsd3_readargs),
758 .pc_ressize = sizeof(struct nfsd3_readres),
759 .pc_cachetype = RC_NOCACHE,
760 .pc_xdrressize = ST+pAT+4+NFSSVC_MAXBLKSIZE/4,
764 .pc_func = nfsd3_proc_write,
765 .pc_decode = nfs3svc_decode_writeargs,
766 .pc_encode = nfs3svc_encode_writeres,
767 .pc_release = nfs3svc_release_fhandle,
768 .pc_argsize = sizeof(struct nfsd3_writeargs),
769 .pc_ressize = sizeof(struct nfsd3_writeres),
770 .pc_cachetype = RC_REPLBUFF,
771 .pc_xdrressize = ST+WC+4,
774 [NFS3PROC_CREATE] = {
775 .pc_func = nfsd3_proc_create,
776 .pc_decode = nfs3svc_decode_createargs,
777 .pc_encode = nfs3svc_encode_createres,
778 .pc_release = nfs3svc_release_fhandle2,
779 .pc_argsize = sizeof(struct nfsd3_createargs),
780 .pc_ressize = sizeof(struct nfsd3_createres),
781 .pc_cachetype = RC_REPLBUFF,
782 .pc_xdrressize = ST+(1+FH+pAT)+WC,
786 .pc_func = nfsd3_proc_mkdir,
787 .pc_decode = nfs3svc_decode_mkdirargs,
788 .pc_encode = nfs3svc_encode_createres,
789 .pc_release = nfs3svc_release_fhandle2,
790 .pc_argsize = sizeof(struct nfsd3_mkdirargs),
791 .pc_ressize = sizeof(struct nfsd3_createres),
792 .pc_cachetype = RC_REPLBUFF,
793 .pc_xdrressize = ST+(1+FH+pAT)+WC,
796 [NFS3PROC_SYMLINK] = {
797 .pc_func = nfsd3_proc_symlink,
798 .pc_decode = nfs3svc_decode_symlinkargs,
799 .pc_encode = nfs3svc_encode_createres,
800 .pc_release = nfs3svc_release_fhandle2,
801 .pc_argsize = sizeof(struct nfsd3_symlinkargs),
802 .pc_ressize = sizeof(struct nfsd3_createres),
803 .pc_cachetype = RC_REPLBUFF,
804 .pc_xdrressize = ST+(1+FH+pAT)+WC,
805 .pc_name = "SYMLINK",
808 .pc_func = nfsd3_proc_mknod,
809 .pc_decode = nfs3svc_decode_mknodargs,
810 .pc_encode = nfs3svc_encode_createres,
811 .pc_release = nfs3svc_release_fhandle2,
812 .pc_argsize = sizeof(struct nfsd3_mknodargs),
813 .pc_ressize = sizeof(struct nfsd3_createres),
814 .pc_cachetype = RC_REPLBUFF,
815 .pc_xdrressize = ST+(1+FH+pAT)+WC,
818 [NFS3PROC_REMOVE] = {
819 .pc_func = nfsd3_proc_remove,
820 .pc_decode = nfs3svc_decode_diropargs,
821 .pc_encode = nfs3svc_encode_wccstatres,
822 .pc_release = nfs3svc_release_fhandle,
823 .pc_argsize = sizeof(struct nfsd3_diropargs),
824 .pc_ressize = sizeof(struct nfsd3_wccstatres),
825 .pc_cachetype = RC_REPLBUFF,
826 .pc_xdrressize = ST+WC,
830 .pc_func = nfsd3_proc_rmdir,
831 .pc_decode = nfs3svc_decode_diropargs,
832 .pc_encode = nfs3svc_encode_wccstatres,
833 .pc_release = nfs3svc_release_fhandle,
834 .pc_argsize = sizeof(struct nfsd3_diropargs),
835 .pc_ressize = sizeof(struct nfsd3_wccstatres),
836 .pc_cachetype = RC_REPLBUFF,
837 .pc_xdrressize = ST+WC,
840 [NFS3PROC_RENAME] = {
841 .pc_func = nfsd3_proc_rename,
842 .pc_decode = nfs3svc_decode_renameargs,
843 .pc_encode = nfs3svc_encode_renameres,
844 .pc_release = nfs3svc_release_fhandle2,
845 .pc_argsize = sizeof(struct nfsd3_renameargs),
846 .pc_ressize = sizeof(struct nfsd3_renameres),
847 .pc_cachetype = RC_REPLBUFF,
848 .pc_xdrressize = ST+WC+WC,
852 .pc_func = nfsd3_proc_link,
853 .pc_decode = nfs3svc_decode_linkargs,
854 .pc_encode = nfs3svc_encode_linkres,
855 .pc_release = nfs3svc_release_fhandle2,
856 .pc_argsize = sizeof(struct nfsd3_linkargs),
857 .pc_ressize = sizeof(struct nfsd3_linkres),
858 .pc_cachetype = RC_REPLBUFF,
859 .pc_xdrressize = ST+pAT+WC,
862 [NFS3PROC_READDIR] = {
863 .pc_func = nfsd3_proc_readdir,
864 .pc_decode = nfs3svc_decode_readdirargs,
865 .pc_encode = nfs3svc_encode_readdirres,
866 .pc_release = nfs3svc_release_fhandle,
867 .pc_argsize = sizeof(struct nfsd3_readdirargs),
868 .pc_ressize = sizeof(struct nfsd3_readdirres),
869 .pc_cachetype = RC_NOCACHE,
870 .pc_name = "READDIR",
872 [NFS3PROC_READDIRPLUS] = {
873 .pc_func = nfsd3_proc_readdirplus,
874 .pc_decode = nfs3svc_decode_readdirplusargs,
875 .pc_encode = nfs3svc_encode_readdirres,
876 .pc_release = nfs3svc_release_fhandle,
877 .pc_argsize = sizeof(struct nfsd3_readdirplusargs),
878 .pc_ressize = sizeof(struct nfsd3_readdirres),
879 .pc_cachetype = RC_NOCACHE,
880 .pc_name = "READDIRPLUS",
882 [NFS3PROC_FSSTAT] = {
883 .pc_func = nfsd3_proc_fsstat,
884 .pc_decode = nfs3svc_decode_fhandleargs,
885 .pc_encode = nfs3svc_encode_fsstatres,
886 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
887 .pc_ressize = sizeof(struct nfsd3_fsstatres),
888 .pc_cachetype = RC_NOCACHE,
889 .pc_xdrressize = ST+pAT+2*6+1,
892 [NFS3PROC_FSINFO] = {
893 .pc_func = nfsd3_proc_fsinfo,
894 .pc_decode = nfs3svc_decode_fhandleargs,
895 .pc_encode = nfs3svc_encode_fsinfores,
896 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
897 .pc_ressize = sizeof(struct nfsd3_fsinfores),
898 .pc_cachetype = RC_NOCACHE,
899 .pc_xdrressize = ST+pAT+12,
902 [NFS3PROC_PATHCONF] = {
903 .pc_func = nfsd3_proc_pathconf,
904 .pc_decode = nfs3svc_decode_fhandleargs,
905 .pc_encode = nfs3svc_encode_pathconfres,
906 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
907 .pc_ressize = sizeof(struct nfsd3_pathconfres),
908 .pc_cachetype = RC_NOCACHE,
909 .pc_xdrressize = ST+pAT+6,
910 .pc_name = "PATHCONF",
912 [NFS3PROC_COMMIT] = {
913 .pc_func = nfsd3_proc_commit,
914 .pc_decode = nfs3svc_decode_commitargs,
915 .pc_encode = nfs3svc_encode_commitres,
916 .pc_release = nfs3svc_release_fhandle,
917 .pc_argsize = sizeof(struct nfsd3_commitargs),
918 .pc_ressize = sizeof(struct nfsd3_commitres),
919 .pc_cachetype = RC_NOCACHE,
920 .pc_xdrressize = ST+WC+2,
925 static unsigned int nfsd_count3[ARRAY_SIZE(nfsd_procedures3)];
926 const struct svc_version nfsd_version3 = {
929 .vs_proc = nfsd_procedures3,
930 .vs_dispatch = nfsd_dispatch,
931 .vs_count = nfsd_count3,
932 .vs_xdrsize = NFS3_SVC_XDRSIZE,