1 // SPDX-License-Identifier: GPL-2.0
3 * Process version 3 NFS requests.
5 * Copyright (C) 1996, 1997, 1998 Olaf Kirch <okir@monad.swb.de>
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 nfsd3_readlinkargs *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->status = nfsd_readlink(rqstp, &resp->fh, argp->buffer, &resp->len);
140 * Read a portion of a file.
143 nfsd3_proc_read(struct svc_rqst *rqstp)
145 struct nfsd3_readargs *argp = rqstp->rq_argp;
146 struct nfsd3_readres *resp = rqstp->rq_resp;
147 u32 max_blocksize = svc_max_payload(rqstp);
148 unsigned long cnt = min(argp->count, max_blocksize);
150 dprintk("nfsd: READ(3) %s %lu bytes at %Lu\n",
151 SVCFH_fmt(&argp->fh),
152 (unsigned long) argp->count,
153 (unsigned long long) argp->offset);
155 /* Obtain buffer pointer for payload.
156 * 1 (status) + 22 (post_op_attr) + 1 (count) + 1 (eof)
157 * + 1 (xdr opaque byte count) = 26
160 svc_reserve_auth(rqstp, ((1 + NFS3_POST_OP_ATTR_WORDS + 3)<<2) + resp->count +4);
162 fh_copy(&resp->fh, &argp->fh);
163 resp->status = nfsd_read(rqstp, &resp->fh, argp->offset,
164 rqstp->rq_vec, argp->vlen, &resp->count,
170 * Write data to a file
173 nfsd3_proc_write(struct svc_rqst *rqstp)
175 struct nfsd3_writeargs *argp = rqstp->rq_argp;
176 struct nfsd3_writeres *resp = rqstp->rq_resp;
177 unsigned long cnt = argp->len;
180 dprintk("nfsd: WRITE(3) %s %d bytes at %Lu%s\n",
181 SVCFH_fmt(&argp->fh),
183 (unsigned long long) argp->offset,
184 argp->stable? " stable" : "");
186 resp->status = nfserr_fbig;
187 if (argp->offset > (u64)OFFSET_MAX ||
188 argp->offset + argp->len > (u64)OFFSET_MAX)
191 fh_copy(&resp->fh, &argp->fh);
192 resp->committed = argp->stable;
193 nvecs = svc_fill_write_vector(rqstp, rqstp->rq_arg.pages,
196 resp->status = nfserr_io;
199 resp->status = nfsd_write(rqstp, &resp->fh, argp->offset,
200 rqstp->rq_vec, nvecs, &cnt,
201 resp->committed, resp->verf);
208 * With NFSv3, CREATE processing is a lot easier than with NFSv2.
209 * At least in theory; we'll see how it fares in practice when the
210 * first reports about SunOS compatibility problems start to pour in...
213 nfsd3_proc_create(struct svc_rqst *rqstp)
215 struct nfsd3_createargs *argp = rqstp->rq_argp;
216 struct nfsd3_diropres *resp = rqstp->rq_resp;
217 svc_fh *dirfhp, *newfhp = NULL;
220 dprintk("nfsd: CREATE(3) %s %.*s\n",
221 SVCFH_fmt(&argp->fh),
225 dirfhp = fh_copy(&resp->dirfh, &argp->fh);
226 newfhp = fh_init(&resp->fh, NFS3_FHSIZE);
229 /* Unfudge the mode bits */
230 attr->ia_mode &= ~S_IFMT;
231 if (!(attr->ia_valid & ATTR_MODE)) {
232 attr->ia_valid |= ATTR_MODE;
233 attr->ia_mode = S_IFREG;
235 attr->ia_mode = (attr->ia_mode & ~S_IFMT) | S_IFREG;
238 /* Now create the file and set attributes */
239 resp->status = do_nfsd_create(rqstp, dirfhp, argp->name, argp->len,
240 attr, newfhp, argp->createmode,
241 (u32 *)argp->verf, NULL, NULL);
246 * Make directory. This operation is not idempotent.
249 nfsd3_proc_mkdir(struct svc_rqst *rqstp)
251 struct nfsd3_createargs *argp = rqstp->rq_argp;
252 struct nfsd3_diropres *resp = rqstp->rq_resp;
254 dprintk("nfsd: MKDIR(3) %s %.*s\n",
255 SVCFH_fmt(&argp->fh),
259 argp->attrs.ia_valid &= ~ATTR_SIZE;
260 fh_copy(&resp->dirfh, &argp->fh);
261 fh_init(&resp->fh, NFS3_FHSIZE);
262 resp->status = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
263 &argp->attrs, S_IFDIR, 0, &resp->fh);
264 fh_unlock(&resp->dirfh);
269 nfsd3_proc_symlink(struct svc_rqst *rqstp)
271 struct nfsd3_symlinkargs *argp = rqstp->rq_argp;
272 struct nfsd3_diropres *resp = rqstp->rq_resp;
274 if (argp->tlen == 0) {
275 resp->status = nfserr_inval;
278 if (argp->tlen > NFS3_MAXPATHLEN) {
279 resp->status = nfserr_nametoolong;
283 argp->tname = svc_fill_symlink_pathname(rqstp, &argp->first,
284 page_address(rqstp->rq_arg.pages[0]),
286 if (IS_ERR(argp->tname)) {
287 resp->status = nfserrno(PTR_ERR(argp->tname));
291 dprintk("nfsd: SYMLINK(3) %s %.*s -> %.*s\n",
292 SVCFH_fmt(&argp->ffh),
293 argp->flen, argp->fname,
294 argp->tlen, argp->tname);
296 fh_copy(&resp->dirfh, &argp->ffh);
297 fh_init(&resp->fh, NFS3_FHSIZE);
298 resp->status = nfsd_symlink(rqstp, &resp->dirfh, argp->fname,
299 argp->flen, argp->tname, &resp->fh);
306 * Make socket/fifo/device.
309 nfsd3_proc_mknod(struct svc_rqst *rqstp)
311 struct nfsd3_mknodargs *argp = rqstp->rq_argp;
312 struct nfsd3_diropres *resp = rqstp->rq_resp;
316 dprintk("nfsd: MKNOD(3) %s %.*s\n",
317 SVCFH_fmt(&argp->fh),
321 fh_copy(&resp->dirfh, &argp->fh);
322 fh_init(&resp->fh, NFS3_FHSIZE);
324 if (argp->ftype == NF3CHR || argp->ftype == NF3BLK) {
325 rdev = MKDEV(argp->major, argp->minor);
326 if (MAJOR(rdev) != argp->major ||
327 MINOR(rdev) != argp->minor) {
328 resp->status = nfserr_inval;
331 } else if (argp->ftype != NF3SOCK && argp->ftype != NF3FIFO) {
332 resp->status = nfserr_badtype;
336 type = nfs3_ftypes[argp->ftype];
337 resp->status = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
338 &argp->attrs, type, rdev, &resp->fh);
339 fh_unlock(&resp->dirfh);
345 * Remove file/fifo/socket etc.
348 nfsd3_proc_remove(struct svc_rqst *rqstp)
350 struct nfsd3_diropargs *argp = rqstp->rq_argp;
351 struct nfsd3_attrstat *resp = rqstp->rq_resp;
353 dprintk("nfsd: REMOVE(3) %s %.*s\n",
354 SVCFH_fmt(&argp->fh),
358 /* Unlink. -S_IFDIR means file must not be a directory */
359 fh_copy(&resp->fh, &argp->fh);
360 resp->status = nfsd_unlink(rqstp, &resp->fh, -S_IFDIR,
361 argp->name, argp->len);
362 fh_unlock(&resp->fh);
370 nfsd3_proc_rmdir(struct svc_rqst *rqstp)
372 struct nfsd3_diropargs *argp = rqstp->rq_argp;
373 struct nfsd3_attrstat *resp = rqstp->rq_resp;
375 dprintk("nfsd: RMDIR(3) %s %.*s\n",
376 SVCFH_fmt(&argp->fh),
380 fh_copy(&resp->fh, &argp->fh);
381 resp->status = nfsd_unlink(rqstp, &resp->fh, S_IFDIR,
382 argp->name, argp->len);
383 fh_unlock(&resp->fh);
388 nfsd3_proc_rename(struct svc_rqst *rqstp)
390 struct nfsd3_renameargs *argp = rqstp->rq_argp;
391 struct nfsd3_renameres *resp = rqstp->rq_resp;
393 dprintk("nfsd: RENAME(3) %s %.*s ->\n",
394 SVCFH_fmt(&argp->ffh),
397 dprintk("nfsd: -> %s %.*s\n",
398 SVCFH_fmt(&argp->tfh),
402 fh_copy(&resp->ffh, &argp->ffh);
403 fh_copy(&resp->tfh, &argp->tfh);
404 resp->status = nfsd_rename(rqstp, &resp->ffh, argp->fname, argp->flen,
405 &resp->tfh, argp->tname, argp->tlen);
410 nfsd3_proc_link(struct svc_rqst *rqstp)
412 struct nfsd3_linkargs *argp = rqstp->rq_argp;
413 struct nfsd3_linkres *resp = rqstp->rq_resp;
415 dprintk("nfsd: LINK(3) %s ->\n",
416 SVCFH_fmt(&argp->ffh));
417 dprintk("nfsd: -> %s %.*s\n",
418 SVCFH_fmt(&argp->tfh),
422 fh_copy(&resp->fh, &argp->ffh);
423 fh_copy(&resp->tfh, &argp->tfh);
424 resp->status = nfsd_link(rqstp, &resp->tfh, argp->tname, argp->tlen,
430 * Read a portion of a directory.
433 nfsd3_proc_readdir(struct svc_rqst *rqstp)
435 struct nfsd3_readdirargs *argp = rqstp->rq_argp;
436 struct nfsd3_readdirres *resp = rqstp->rq_resp;
439 caddr_t page_addr = NULL;
441 dprintk("nfsd: READDIR(3) %s %d bytes at %d\n",
442 SVCFH_fmt(&argp->fh),
443 argp->count, (u32) argp->cookie);
445 /* Make sure we've room for the NULL ptr & eof flag, and shrink to
446 * client read size */
447 count = (argp->count >> 2) - 2;
449 /* Read directory and encode entries on the fly */
450 fh_copy(&resp->fh, &argp->fh);
452 resp->buflen = count;
453 resp->common.err = nfs_ok;
454 resp->buffer = argp->buffer;
456 resp->status = nfsd_readdir(rqstp, &resp->fh, (loff_t *)&argp->cookie,
457 &resp->common, nfs3svc_encode_entry);
458 memcpy(resp->verf, argp->verf, 8);
460 for (p = rqstp->rq_respages + 1; p < rqstp->rq_next_page; p++) {
461 page_addr = page_address(*p);
463 if (((caddr_t)resp->buffer >= page_addr) &&
464 ((caddr_t)resp->buffer < page_addr + PAGE_SIZE)) {
465 count += (caddr_t)resp->buffer - page_addr;
470 resp->count = count >> 2;
472 loff_t offset = argp->cookie;
474 if (unlikely(resp->offset1)) {
475 /* we ended up with offset on a page boundary */
476 *resp->offset = htonl(offset >> 32);
477 *resp->offset1 = htonl(offset & 0xffffffff);
478 resp->offset1 = NULL;
480 xdr_encode_hyper(resp->offset, offset);
489 * Read a portion of a directory, including file handles and attrs.
490 * For now, we choose to ignore the dircount parameter.
493 nfsd3_proc_readdirplus(struct svc_rqst *rqstp)
495 struct nfsd3_readdirargs *argp = rqstp->rq_argp;
496 struct nfsd3_readdirres *resp = rqstp->rq_resp;
500 caddr_t page_addr = NULL;
502 dprintk("nfsd: READDIR+(3) %s %d bytes at %d\n",
503 SVCFH_fmt(&argp->fh),
504 argp->count, (u32) argp->cookie);
506 /* Convert byte count to number of words (i.e. >> 2),
507 * and reserve room for the NULL ptr & eof flag (-2 words) */
508 resp->count = (argp->count >> 2) - 2;
510 /* Read directory and encode entries on the fly */
511 fh_copy(&resp->fh, &argp->fh);
513 resp->common.err = nfs_ok;
514 resp->buffer = argp->buffer;
515 resp->buflen = resp->count;
517 offset = argp->cookie;
519 resp->status = fh_verify(rqstp, &resp->fh, S_IFDIR, NFSD_MAY_NOP);
520 if (resp->status != nfs_ok)
523 if (resp->fh.fh_export->ex_flags & NFSEXP_NOREADDIRPLUS) {
524 resp->status = nfserr_notsupp;
528 resp->status = nfsd_readdir(rqstp, &resp->fh, &offset,
529 &resp->common, nfs3svc_encode_entry_plus);
530 memcpy(resp->verf, argp->verf, 8);
531 for (p = rqstp->rq_respages + 1; p < rqstp->rq_next_page; p++) {
532 page_addr = page_address(*p);
534 if (((caddr_t)resp->buffer >= page_addr) &&
535 ((caddr_t)resp->buffer < page_addr + PAGE_SIZE)) {
536 count += (caddr_t)resp->buffer - page_addr;
541 resp->count = count >> 2;
543 if (unlikely(resp->offset1)) {
544 /* we ended up with offset on a page boundary */
545 *resp->offset = htonl(offset >> 32);
546 *resp->offset1 = htonl(offset & 0xffffffff);
547 resp->offset1 = NULL;
549 xdr_encode_hyper(resp->offset, offset);
559 * Get file system stats
562 nfsd3_proc_fsstat(struct svc_rqst *rqstp)
564 struct nfsd_fhandle *argp = rqstp->rq_argp;
565 struct nfsd3_fsstatres *resp = rqstp->rq_resp;
567 dprintk("nfsd: FSSTAT(3) %s\n",
568 SVCFH_fmt(&argp->fh));
570 resp->status = nfsd_statfs(rqstp, &argp->fh, &resp->stats, 0);
576 * Get file system info
579 nfsd3_proc_fsinfo(struct svc_rqst *rqstp)
581 struct nfsd_fhandle *argp = rqstp->rq_argp;
582 struct nfsd3_fsinfores *resp = rqstp->rq_resp;
583 u32 max_blocksize = svc_max_payload(rqstp);
585 dprintk("nfsd: FSINFO(3) %s\n",
586 SVCFH_fmt(&argp->fh));
588 resp->f_rtmax = max_blocksize;
589 resp->f_rtpref = max_blocksize;
590 resp->f_rtmult = PAGE_SIZE;
591 resp->f_wtmax = max_blocksize;
592 resp->f_wtpref = max_blocksize;
593 resp->f_wtmult = PAGE_SIZE;
594 resp->f_dtpref = max_blocksize;
595 resp->f_maxfilesize = ~(u32) 0;
596 resp->f_properties = NFS3_FSF_DEFAULT;
598 resp->status = fh_verify(rqstp, &argp->fh, 0,
599 NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT);
601 /* Check special features of the file system. May request
602 * different read/write sizes for file systems known to have
603 * problems with large blocks */
604 if (resp->status == nfs_ok) {
605 struct super_block *sb = argp->fh.fh_dentry->d_sb;
607 /* Note that we don't care for remote fs's here */
608 if (sb->s_magic == MSDOS_SUPER_MAGIC) {
609 resp->f_properties = NFS3_FSF_BILLYBOY;
611 resp->f_maxfilesize = sb->s_maxbytes;
619 * Get pathconf info for the specified file
622 nfsd3_proc_pathconf(struct svc_rqst *rqstp)
624 struct nfsd_fhandle *argp = rqstp->rq_argp;
625 struct nfsd3_pathconfres *resp = rqstp->rq_resp;
627 dprintk("nfsd: PATHCONF(3) %s\n",
628 SVCFH_fmt(&argp->fh));
630 /* Set default pathconf */
631 resp->p_link_max = 255; /* at least */
632 resp->p_name_max = 255; /* at least */
633 resp->p_no_trunc = 0;
634 resp->p_chown_restricted = 1;
635 resp->p_case_insensitive = 0;
636 resp->p_case_preserving = 1;
638 resp->status = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP);
640 if (resp->status == nfs_ok) {
641 struct super_block *sb = argp->fh.fh_dentry->d_sb;
643 /* Note that we don't care for remote fs's here */
644 switch (sb->s_magic) {
645 case EXT2_SUPER_MAGIC:
646 resp->p_link_max = EXT2_LINK_MAX;
647 resp->p_name_max = EXT2_NAME_LEN;
649 case MSDOS_SUPER_MAGIC:
650 resp->p_case_insensitive = 1;
651 resp->p_case_preserving = 0;
661 * Commit a file (range) to stable storage.
664 nfsd3_proc_commit(struct svc_rqst *rqstp)
666 struct nfsd3_commitargs *argp = rqstp->rq_argp;
667 struct nfsd3_commitres *resp = rqstp->rq_resp;
669 dprintk("nfsd: COMMIT(3) %s %u@%Lu\n",
670 SVCFH_fmt(&argp->fh),
672 (unsigned long long) argp->offset);
674 if (argp->offset > NFS_OFFSET_MAX) {
675 resp->status = nfserr_inval;
679 fh_copy(&resp->fh, &argp->fh);
680 resp->status = nfsd_commit(rqstp, &resp->fh, argp->offset,
681 argp->count, resp->verf);
688 * NFSv3 Server procedures.
689 * Only the results of non-idempotent operations are cached.
691 #define nfs3svc_decode_fhandleargs nfs3svc_decode_fhandle
692 #define nfs3svc_encode_attrstatres nfs3svc_encode_attrstat
693 #define nfs3svc_encode_wccstatres nfs3svc_encode_wccstat
694 #define nfsd3_mkdirargs nfsd3_createargs
695 #define nfsd3_readdirplusargs nfsd3_readdirargs
696 #define nfsd3_fhandleargs nfsd_fhandle
697 #define nfsd3_fhandleres nfsd3_attrstat
698 #define nfsd3_attrstatres nfsd3_attrstat
699 #define nfsd3_wccstatres nfsd3_attrstat
700 #define nfsd3_createres nfsd3_diropres
701 #define nfsd3_voidres nfsd3_voidargs
702 struct nfsd3_voidargs { int dummy; };
704 #define ST 1 /* status*/
705 #define FH 17 /* filehandle with length */
706 #define AT 21 /* attributes */
707 #define pAT (1+AT) /* post attributes - conditional */
708 #define WC (7+pAT) /* WCC attributes */
710 static const struct svc_procedure nfsd_procedures3[22] = {
712 .pc_func = nfsd3_proc_null,
713 .pc_decode = nfs3svc_decode_voidarg,
714 .pc_encode = nfs3svc_encode_voidres,
715 .pc_argsize = sizeof(struct nfsd3_voidargs),
716 .pc_ressize = sizeof(struct nfsd3_voidres),
717 .pc_cachetype = RC_NOCACHE,
720 [NFS3PROC_GETATTR] = {
721 .pc_func = nfsd3_proc_getattr,
722 .pc_decode = nfs3svc_decode_fhandleargs,
723 .pc_encode = nfs3svc_encode_attrstatres,
724 .pc_release = nfs3svc_release_fhandle,
725 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
726 .pc_ressize = sizeof(struct nfsd3_attrstatres),
727 .pc_cachetype = RC_NOCACHE,
728 .pc_xdrressize = ST+AT,
730 [NFS3PROC_SETATTR] = {
731 .pc_func = nfsd3_proc_setattr,
732 .pc_decode = nfs3svc_decode_sattrargs,
733 .pc_encode = nfs3svc_encode_wccstatres,
734 .pc_release = nfs3svc_release_fhandle,
735 .pc_argsize = sizeof(struct nfsd3_sattrargs),
736 .pc_ressize = sizeof(struct nfsd3_wccstatres),
737 .pc_cachetype = RC_REPLBUFF,
738 .pc_xdrressize = ST+WC,
740 [NFS3PROC_LOOKUP] = {
741 .pc_func = nfsd3_proc_lookup,
742 .pc_decode = nfs3svc_decode_diropargs,
743 .pc_encode = nfs3svc_encode_diropres,
744 .pc_release = nfs3svc_release_fhandle2,
745 .pc_argsize = sizeof(struct nfsd3_diropargs),
746 .pc_ressize = sizeof(struct nfsd3_diropres),
747 .pc_cachetype = RC_NOCACHE,
748 .pc_xdrressize = ST+FH+pAT+pAT,
750 [NFS3PROC_ACCESS] = {
751 .pc_func = nfsd3_proc_access,
752 .pc_decode = nfs3svc_decode_accessargs,
753 .pc_encode = nfs3svc_encode_accessres,
754 .pc_release = nfs3svc_release_fhandle,
755 .pc_argsize = sizeof(struct nfsd3_accessargs),
756 .pc_ressize = sizeof(struct nfsd3_accessres),
757 .pc_cachetype = RC_NOCACHE,
758 .pc_xdrressize = ST+pAT+1,
760 [NFS3PROC_READLINK] = {
761 .pc_func = nfsd3_proc_readlink,
762 .pc_decode = nfs3svc_decode_readlinkargs,
763 .pc_encode = nfs3svc_encode_readlinkres,
764 .pc_release = nfs3svc_release_fhandle,
765 .pc_argsize = sizeof(struct nfsd3_readlinkargs),
766 .pc_ressize = sizeof(struct nfsd3_readlinkres),
767 .pc_cachetype = RC_NOCACHE,
768 .pc_xdrressize = ST+pAT+1+NFS3_MAXPATHLEN/4,
771 .pc_func = nfsd3_proc_read,
772 .pc_decode = nfs3svc_decode_readargs,
773 .pc_encode = nfs3svc_encode_readres,
774 .pc_release = nfs3svc_release_fhandle,
775 .pc_argsize = sizeof(struct nfsd3_readargs),
776 .pc_ressize = sizeof(struct nfsd3_readres),
777 .pc_cachetype = RC_NOCACHE,
778 .pc_xdrressize = ST+pAT+4+NFSSVC_MAXBLKSIZE/4,
781 .pc_func = nfsd3_proc_write,
782 .pc_decode = nfs3svc_decode_writeargs,
783 .pc_encode = nfs3svc_encode_writeres,
784 .pc_release = nfs3svc_release_fhandle,
785 .pc_argsize = sizeof(struct nfsd3_writeargs),
786 .pc_ressize = sizeof(struct nfsd3_writeres),
787 .pc_cachetype = RC_REPLBUFF,
788 .pc_xdrressize = ST+WC+4,
790 [NFS3PROC_CREATE] = {
791 .pc_func = nfsd3_proc_create,
792 .pc_decode = nfs3svc_decode_createargs,
793 .pc_encode = nfs3svc_encode_createres,
794 .pc_release = nfs3svc_release_fhandle2,
795 .pc_argsize = sizeof(struct nfsd3_createargs),
796 .pc_ressize = sizeof(struct nfsd3_createres),
797 .pc_cachetype = RC_REPLBUFF,
798 .pc_xdrressize = ST+(1+FH+pAT)+WC,
801 .pc_func = nfsd3_proc_mkdir,
802 .pc_decode = nfs3svc_decode_mkdirargs,
803 .pc_encode = nfs3svc_encode_createres,
804 .pc_release = nfs3svc_release_fhandle2,
805 .pc_argsize = sizeof(struct nfsd3_mkdirargs),
806 .pc_ressize = sizeof(struct nfsd3_createres),
807 .pc_cachetype = RC_REPLBUFF,
808 .pc_xdrressize = ST+(1+FH+pAT)+WC,
810 [NFS3PROC_SYMLINK] = {
811 .pc_func = nfsd3_proc_symlink,
812 .pc_decode = nfs3svc_decode_symlinkargs,
813 .pc_encode = nfs3svc_encode_createres,
814 .pc_release = nfs3svc_release_fhandle2,
815 .pc_argsize = sizeof(struct nfsd3_symlinkargs),
816 .pc_ressize = sizeof(struct nfsd3_createres),
817 .pc_cachetype = RC_REPLBUFF,
818 .pc_xdrressize = ST+(1+FH+pAT)+WC,
821 .pc_func = nfsd3_proc_mknod,
822 .pc_decode = nfs3svc_decode_mknodargs,
823 .pc_encode = nfs3svc_encode_createres,
824 .pc_release = nfs3svc_release_fhandle2,
825 .pc_argsize = sizeof(struct nfsd3_mknodargs),
826 .pc_ressize = sizeof(struct nfsd3_createres),
827 .pc_cachetype = RC_REPLBUFF,
828 .pc_xdrressize = ST+(1+FH+pAT)+WC,
830 [NFS3PROC_REMOVE] = {
831 .pc_func = nfsd3_proc_remove,
832 .pc_decode = nfs3svc_decode_diropargs,
833 .pc_encode = nfs3svc_encode_wccstatres,
834 .pc_release = nfs3svc_release_fhandle,
835 .pc_argsize = sizeof(struct nfsd3_diropargs),
836 .pc_ressize = sizeof(struct nfsd3_wccstatres),
837 .pc_cachetype = RC_REPLBUFF,
838 .pc_xdrressize = ST+WC,
841 .pc_func = nfsd3_proc_rmdir,
842 .pc_decode = nfs3svc_decode_diropargs,
843 .pc_encode = nfs3svc_encode_wccstatres,
844 .pc_release = nfs3svc_release_fhandle,
845 .pc_argsize = sizeof(struct nfsd3_diropargs),
846 .pc_ressize = sizeof(struct nfsd3_wccstatres),
847 .pc_cachetype = RC_REPLBUFF,
848 .pc_xdrressize = ST+WC,
850 [NFS3PROC_RENAME] = {
851 .pc_func = nfsd3_proc_rename,
852 .pc_decode = nfs3svc_decode_renameargs,
853 .pc_encode = nfs3svc_encode_renameres,
854 .pc_release = nfs3svc_release_fhandle2,
855 .pc_argsize = sizeof(struct nfsd3_renameargs),
856 .pc_ressize = sizeof(struct nfsd3_renameres),
857 .pc_cachetype = RC_REPLBUFF,
858 .pc_xdrressize = ST+WC+WC,
861 .pc_func = nfsd3_proc_link,
862 .pc_decode = nfs3svc_decode_linkargs,
863 .pc_encode = nfs3svc_encode_linkres,
864 .pc_release = nfs3svc_release_fhandle2,
865 .pc_argsize = sizeof(struct nfsd3_linkargs),
866 .pc_ressize = sizeof(struct nfsd3_linkres),
867 .pc_cachetype = RC_REPLBUFF,
868 .pc_xdrressize = ST+pAT+WC,
870 [NFS3PROC_READDIR] = {
871 .pc_func = nfsd3_proc_readdir,
872 .pc_decode = nfs3svc_decode_readdirargs,
873 .pc_encode = nfs3svc_encode_readdirres,
874 .pc_release = nfs3svc_release_fhandle,
875 .pc_argsize = sizeof(struct nfsd3_readdirargs),
876 .pc_ressize = sizeof(struct nfsd3_readdirres),
877 .pc_cachetype = RC_NOCACHE,
879 [NFS3PROC_READDIRPLUS] = {
880 .pc_func = nfsd3_proc_readdirplus,
881 .pc_decode = nfs3svc_decode_readdirplusargs,
882 .pc_encode = nfs3svc_encode_readdirres,
883 .pc_release = nfs3svc_release_fhandle,
884 .pc_argsize = sizeof(struct nfsd3_readdirplusargs),
885 .pc_ressize = sizeof(struct nfsd3_readdirres),
886 .pc_cachetype = RC_NOCACHE,
888 [NFS3PROC_FSSTAT] = {
889 .pc_func = nfsd3_proc_fsstat,
890 .pc_decode = nfs3svc_decode_fhandleargs,
891 .pc_encode = nfs3svc_encode_fsstatres,
892 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
893 .pc_ressize = sizeof(struct nfsd3_fsstatres),
894 .pc_cachetype = RC_NOCACHE,
895 .pc_xdrressize = ST+pAT+2*6+1,
897 [NFS3PROC_FSINFO] = {
898 .pc_func = nfsd3_proc_fsinfo,
899 .pc_decode = nfs3svc_decode_fhandleargs,
900 .pc_encode = nfs3svc_encode_fsinfores,
901 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
902 .pc_ressize = sizeof(struct nfsd3_fsinfores),
903 .pc_cachetype = RC_NOCACHE,
904 .pc_xdrressize = ST+pAT+12,
906 [NFS3PROC_PATHCONF] = {
907 .pc_func = nfsd3_proc_pathconf,
908 .pc_decode = nfs3svc_decode_fhandleargs,
909 .pc_encode = nfs3svc_encode_pathconfres,
910 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
911 .pc_ressize = sizeof(struct nfsd3_pathconfres),
912 .pc_cachetype = RC_NOCACHE,
913 .pc_xdrressize = ST+pAT+6,
915 [NFS3PROC_COMMIT] = {
916 .pc_func = nfsd3_proc_commit,
917 .pc_decode = nfs3svc_decode_commitargs,
918 .pc_encode = nfs3svc_encode_commitres,
919 .pc_release = nfs3svc_release_fhandle,
920 .pc_argsize = sizeof(struct nfsd3_commitargs),
921 .pc_ressize = sizeof(struct nfsd3_commitres),
922 .pc_cachetype = RC_NOCACHE,
923 .pc_xdrressize = ST+WC+2,
927 static unsigned int nfsd_count3[ARRAY_SIZE(nfsd_procedures3)];
928 const struct svc_version nfsd_version3 = {
931 .vs_proc = nfsd_procedures3,
932 .vs_dispatch = nfsd_dispatch,
933 .vs_count = nfsd_count3,
934 .vs_xdrsize = NFS3_SVC_XDRSIZE,