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 #define RETURN_STATUS(st) { resp->status = (st); return (st); }
20 static int nfs3_ftypes[] = {
27 S_IFSOCK, /* NF3SOCK */
28 S_IFIFO, /* NF3FIFO */
35 nfsd3_proc_null(struct svc_rqst *rqstp)
41 * Get a file's attributes
44 nfsd3_proc_getattr(struct svc_rqst *rqstp)
46 struct nfsd_fhandle *argp = rqstp->rq_argp;
47 struct nfsd3_attrstat *resp = rqstp->rq_resp;
50 dprintk("nfsd: GETATTR(3) %s\n",
51 SVCFH_fmt(&argp->fh));
53 fh_copy(&resp->fh, &argp->fh);
54 nfserr = fh_verify(rqstp, &resp->fh, 0,
55 NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT);
57 RETURN_STATUS(nfserr);
59 nfserr = fh_getattr(&resp->fh, &resp->stat);
61 RETURN_STATUS(nfserr);
65 * Set a file's attributes
68 nfsd3_proc_setattr(struct svc_rqst *rqstp)
70 struct nfsd3_sattrargs *argp = rqstp->rq_argp;
71 struct nfsd3_attrstat *resp = rqstp->rq_resp;
74 dprintk("nfsd: SETATTR(3) %s\n",
75 SVCFH_fmt(&argp->fh));
77 fh_copy(&resp->fh, &argp->fh);
78 nfserr = nfsd_setattr(rqstp, &resp->fh, &argp->attrs,
79 argp->check_guard, argp->guardtime);
80 RETURN_STATUS(nfserr);
84 * Look up a path name component
87 nfsd3_proc_lookup(struct svc_rqst *rqstp)
89 struct nfsd3_diropargs *argp = rqstp->rq_argp;
90 struct nfsd3_diropres *resp = rqstp->rq_resp;
93 dprintk("nfsd: LOOKUP(3) %s %.*s\n",
98 fh_copy(&resp->dirfh, &argp->fh);
99 fh_init(&resp->fh, NFS3_FHSIZE);
101 nfserr = nfsd_lookup(rqstp, &resp->dirfh,
105 RETURN_STATUS(nfserr);
112 nfsd3_proc_access(struct svc_rqst *rqstp)
114 struct nfsd3_accessargs *argp = rqstp->rq_argp;
115 struct nfsd3_accessres *resp = rqstp->rq_resp;
118 dprintk("nfsd: ACCESS(3) %s 0x%x\n",
119 SVCFH_fmt(&argp->fh),
122 fh_copy(&resp->fh, &argp->fh);
123 resp->access = argp->access;
124 nfserr = nfsd_access(rqstp, &resp->fh, &resp->access, NULL);
125 RETURN_STATUS(nfserr);
132 nfsd3_proc_readlink(struct svc_rqst *rqstp)
134 struct nfsd3_readlinkargs *argp = rqstp->rq_argp;
135 struct nfsd3_readlinkres *resp = rqstp->rq_resp;
138 dprintk("nfsd: READLINK(3) %s\n", SVCFH_fmt(&argp->fh));
140 /* Read the symlink. */
141 fh_copy(&resp->fh, &argp->fh);
142 resp->len = NFS3_MAXPATHLEN;
143 nfserr = nfsd_readlink(rqstp, &resp->fh, argp->buffer, &resp->len);
144 RETURN_STATUS(nfserr);
148 * Read a portion of a file.
151 nfsd3_proc_read(struct svc_rqst *rqstp)
153 struct nfsd3_readargs *argp = rqstp->rq_argp;
154 struct nfsd3_readres *resp = rqstp->rq_resp;
156 u32 max_blocksize = svc_max_payload(rqstp);
157 unsigned long cnt = min(argp->count, max_blocksize);
159 dprintk("nfsd: READ(3) %s %lu bytes at %Lu\n",
160 SVCFH_fmt(&argp->fh),
161 (unsigned long) argp->count,
162 (unsigned long long) argp->offset);
164 /* Obtain buffer pointer for payload.
165 * 1 (status) + 22 (post_op_attr) + 1 (count) + 1 (eof)
166 * + 1 (xdr opaque byte count) = 26
169 svc_reserve_auth(rqstp, ((1 + NFS3_POST_OP_ATTR_WORDS + 3)<<2) + resp->count +4);
171 fh_copy(&resp->fh, &argp->fh);
172 nfserr = nfsd_read(rqstp, &resp->fh,
174 rqstp->rq_vec, argp->vlen,
177 struct inode *inode = d_inode(resp->fh.fh_dentry);
178 resp->eof = nfsd_eof_on_read(cnt, resp->count, argp->offset,
182 RETURN_STATUS(nfserr);
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;
194 unsigned long cnt = argp->len;
197 dprintk("nfsd: WRITE(3) %s %d bytes at %Lu%s\n",
198 SVCFH_fmt(&argp->fh),
200 (unsigned long long) argp->offset,
201 argp->stable? " stable" : "");
203 resp->status = nfserr_fbig;
204 if (argp->offset > (u64)OFFSET_MAX ||
205 argp->offset + argp->len > (u64)OFFSET_MAX)
208 fh_copy(&resp->fh, &argp->fh);
209 resp->committed = argp->stable;
210 nvecs = svc_fill_write_vector(rqstp, rqstp->rq_arg.pages,
213 RETURN_STATUS(nfserr_io);
214 nfserr = nfsd_write(rqstp, &resp->fh, argp->offset,
215 rqstp->rq_vec, nvecs, &cnt,
218 RETURN_STATUS(nfserr);
222 * With NFSv3, CREATE processing is a lot easier than with NFSv2.
223 * At least in theory; we'll see how it fares in practice when the
224 * first reports about SunOS compatibility problems start to pour in...
227 nfsd3_proc_create(struct svc_rqst *rqstp)
229 struct nfsd3_createargs *argp = rqstp->rq_argp;
230 struct nfsd3_diropres *resp = rqstp->rq_resp;
231 svc_fh *dirfhp, *newfhp = NULL;
235 dprintk("nfsd: CREATE(3) %s %.*s\n",
236 SVCFH_fmt(&argp->fh),
240 dirfhp = fh_copy(&resp->dirfh, &argp->fh);
241 newfhp = fh_init(&resp->fh, NFS3_FHSIZE);
244 /* Unfudge the mode bits */
245 attr->ia_mode &= ~S_IFMT;
246 if (!(attr->ia_valid & ATTR_MODE)) {
247 attr->ia_valid |= ATTR_MODE;
248 attr->ia_mode = S_IFREG;
250 attr->ia_mode = (attr->ia_mode & ~S_IFMT) | S_IFREG;
253 /* Now create the file and set attributes */
254 nfserr = do_nfsd_create(rqstp, dirfhp, argp->name, argp->len,
256 argp->createmode, (u32 *)argp->verf, NULL, NULL);
258 RETURN_STATUS(nfserr);
262 * Make directory. This operation is not idempotent.
265 nfsd3_proc_mkdir(struct svc_rqst *rqstp)
267 struct nfsd3_createargs *argp = rqstp->rq_argp;
268 struct nfsd3_diropres *resp = rqstp->rq_resp;
271 dprintk("nfsd: MKDIR(3) %s %.*s\n",
272 SVCFH_fmt(&argp->fh),
276 argp->attrs.ia_valid &= ~ATTR_SIZE;
277 fh_copy(&resp->dirfh, &argp->fh);
278 fh_init(&resp->fh, NFS3_FHSIZE);
279 nfserr = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
280 &argp->attrs, S_IFDIR, 0, &resp->fh);
281 fh_unlock(&resp->dirfh);
282 RETURN_STATUS(nfserr);
286 nfsd3_proc_symlink(struct svc_rqst *rqstp)
288 struct nfsd3_symlinkargs *argp = rqstp->rq_argp;
289 struct nfsd3_diropres *resp = rqstp->rq_resp;
293 RETURN_STATUS(nfserr_inval);
294 if (argp->tlen > NFS3_MAXPATHLEN)
295 RETURN_STATUS(nfserr_nametoolong);
297 argp->tname = svc_fill_symlink_pathname(rqstp, &argp->first,
298 page_address(rqstp->rq_arg.pages[0]),
300 if (IS_ERR(argp->tname))
301 RETURN_STATUS(nfserrno(PTR_ERR(argp->tname)));
303 dprintk("nfsd: SYMLINK(3) %s %.*s -> %.*s\n",
304 SVCFH_fmt(&argp->ffh),
305 argp->flen, argp->fname,
306 argp->tlen, argp->tname);
308 fh_copy(&resp->dirfh, &argp->ffh);
309 fh_init(&resp->fh, NFS3_FHSIZE);
310 nfserr = nfsd_symlink(rqstp, &resp->dirfh, argp->fname, argp->flen,
311 argp->tname, &resp->fh);
313 RETURN_STATUS(nfserr);
317 * Make socket/fifo/device.
320 nfsd3_proc_mknod(struct svc_rqst *rqstp)
322 struct nfsd3_mknodargs *argp = rqstp->rq_argp;
323 struct nfsd3_diropres *resp = rqstp->rq_resp;
328 dprintk("nfsd: MKNOD(3) %s %.*s\n",
329 SVCFH_fmt(&argp->fh),
333 fh_copy(&resp->dirfh, &argp->fh);
334 fh_init(&resp->fh, NFS3_FHSIZE);
336 if (argp->ftype == 0 || argp->ftype >= NF3BAD)
337 RETURN_STATUS(nfserr_inval);
338 if (argp->ftype == NF3CHR || argp->ftype == NF3BLK) {
339 rdev = MKDEV(argp->major, argp->minor);
340 if (MAJOR(rdev) != argp->major ||
341 MINOR(rdev) != argp->minor)
342 RETURN_STATUS(nfserr_inval);
344 if (argp->ftype != NF3SOCK && argp->ftype != NF3FIFO)
345 RETURN_STATUS(nfserr_inval);
347 type = nfs3_ftypes[argp->ftype];
348 nfserr = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
349 &argp->attrs, type, rdev, &resp->fh);
350 fh_unlock(&resp->dirfh);
351 RETURN_STATUS(nfserr);
355 * Remove file/fifo/socket etc.
358 nfsd3_proc_remove(struct svc_rqst *rqstp)
360 struct nfsd3_diropargs *argp = rqstp->rq_argp;
361 struct nfsd3_attrstat *resp = rqstp->rq_resp;
364 dprintk("nfsd: REMOVE(3) %s %.*s\n",
365 SVCFH_fmt(&argp->fh),
369 /* Unlink. -S_IFDIR means file must not be a directory */
370 fh_copy(&resp->fh, &argp->fh);
371 nfserr = nfsd_unlink(rqstp, &resp->fh, -S_IFDIR, argp->name, argp->len);
372 fh_unlock(&resp->fh);
373 RETURN_STATUS(nfserr);
380 nfsd3_proc_rmdir(struct svc_rqst *rqstp)
382 struct nfsd3_diropargs *argp = rqstp->rq_argp;
383 struct nfsd3_attrstat *resp = rqstp->rq_resp;
386 dprintk("nfsd: RMDIR(3) %s %.*s\n",
387 SVCFH_fmt(&argp->fh),
391 fh_copy(&resp->fh, &argp->fh);
392 nfserr = nfsd_unlink(rqstp, &resp->fh, S_IFDIR, argp->name, argp->len);
393 fh_unlock(&resp->fh);
394 RETURN_STATUS(nfserr);
398 nfsd3_proc_rename(struct svc_rqst *rqstp)
400 struct nfsd3_renameargs *argp = rqstp->rq_argp;
401 struct nfsd3_renameres *resp = rqstp->rq_resp;
404 dprintk("nfsd: RENAME(3) %s %.*s ->\n",
405 SVCFH_fmt(&argp->ffh),
408 dprintk("nfsd: -> %s %.*s\n",
409 SVCFH_fmt(&argp->tfh),
413 fh_copy(&resp->ffh, &argp->ffh);
414 fh_copy(&resp->tfh, &argp->tfh);
415 nfserr = nfsd_rename(rqstp, &resp->ffh, argp->fname, argp->flen,
416 &resp->tfh, argp->tname, argp->tlen);
417 RETURN_STATUS(nfserr);
421 nfsd3_proc_link(struct svc_rqst *rqstp)
423 struct nfsd3_linkargs *argp = rqstp->rq_argp;
424 struct nfsd3_linkres *resp = rqstp->rq_resp;
427 dprintk("nfsd: LINK(3) %s ->\n",
428 SVCFH_fmt(&argp->ffh));
429 dprintk("nfsd: -> %s %.*s\n",
430 SVCFH_fmt(&argp->tfh),
434 fh_copy(&resp->fh, &argp->ffh);
435 fh_copy(&resp->tfh, &argp->tfh);
436 nfserr = nfsd_link(rqstp, &resp->tfh, argp->tname, argp->tlen,
438 RETURN_STATUS(nfserr);
442 * Read a portion of a directory.
445 nfsd3_proc_readdir(struct svc_rqst *rqstp)
447 struct nfsd3_readdirargs *argp = rqstp->rq_argp;
448 struct nfsd3_readdirres *resp = rqstp->rq_resp;
452 dprintk("nfsd: READDIR(3) %s %d bytes at %d\n",
453 SVCFH_fmt(&argp->fh),
454 argp->count, (u32) argp->cookie);
456 /* Make sure we've room for the NULL ptr & eof flag, and shrink to
457 * client read size */
458 count = (argp->count >> 2) - 2;
460 /* Read directory and encode entries on the fly */
461 fh_copy(&resp->fh, &argp->fh);
463 resp->buflen = count;
464 resp->common.err = nfs_ok;
465 resp->buffer = argp->buffer;
467 nfserr = nfsd_readdir(rqstp, &resp->fh, (loff_t*) &argp->cookie,
468 &resp->common, nfs3svc_encode_entry);
469 memcpy(resp->verf, argp->verf, 8);
470 resp->count = resp->buffer - argp->buffer;
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);
485 RETURN_STATUS(nfserr);
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;
501 caddr_t page_addr = NULL;
503 dprintk("nfsd: READDIR+(3) %s %d bytes at %d\n",
504 SVCFH_fmt(&argp->fh),
505 argp->count, (u32) argp->cookie);
507 /* Convert byte count to number of words (i.e. >> 2),
508 * and reserve room for the NULL ptr & eof flag (-2 words) */
509 resp->count = (argp->count >> 2) - 2;
511 /* Read directory and encode entries on the fly */
512 fh_copy(&resp->fh, &argp->fh);
514 resp->common.err = nfs_ok;
515 resp->buffer = argp->buffer;
516 resp->buflen = resp->count;
518 offset = argp->cookie;
520 nfserr = fh_verify(rqstp, &resp->fh, S_IFDIR, NFSD_MAY_NOP);
522 RETURN_STATUS(nfserr);
524 if (resp->fh.fh_export->ex_flags & NFSEXP_NOREADDIRPLUS)
525 RETURN_STATUS(nfserr_notsupp);
527 nfserr = nfsd_readdir(rqstp, &resp->fh,
530 nfs3svc_encode_entry_plus);
531 memcpy(resp->verf, argp->verf, 8);
532 for (p = rqstp->rq_respages + 1; p < rqstp->rq_next_page; p++) {
533 page_addr = page_address(*p);
535 if (((caddr_t)resp->buffer >= page_addr) &&
536 ((caddr_t)resp->buffer < page_addr + PAGE_SIZE)) {
537 count += (caddr_t)resp->buffer - page_addr;
542 resp->count = count >> 2;
544 if (unlikely(resp->offset1)) {
545 /* we ended up with offset on a page boundary */
546 *resp->offset = htonl(offset >> 32);
547 *resp->offset1 = htonl(offset & 0xffffffff);
548 resp->offset1 = NULL;
550 xdr_encode_hyper(resp->offset, offset);
555 RETURN_STATUS(nfserr);
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;
568 dprintk("nfsd: FSSTAT(3) %s\n",
569 SVCFH_fmt(&argp->fh));
571 nfserr = nfsd_statfs(rqstp, &argp->fh, &resp->stats, 0);
573 RETURN_STATUS(nfserr);
577 * Get file system info
580 nfsd3_proc_fsinfo(struct svc_rqst *rqstp)
582 struct nfsd_fhandle *argp = rqstp->rq_argp;
583 struct nfsd3_fsinfores *resp = rqstp->rq_resp;
585 u32 max_blocksize = svc_max_payload(rqstp);
587 dprintk("nfsd: FSINFO(3) %s\n",
588 SVCFH_fmt(&argp->fh));
590 resp->f_rtmax = max_blocksize;
591 resp->f_rtpref = max_blocksize;
592 resp->f_rtmult = PAGE_SIZE;
593 resp->f_wtmax = max_blocksize;
594 resp->f_wtpref = max_blocksize;
595 resp->f_wtmult = PAGE_SIZE;
596 resp->f_dtpref = PAGE_SIZE;
597 resp->f_maxfilesize = ~(u32) 0;
598 resp->f_properties = NFS3_FSF_DEFAULT;
600 nfserr = fh_verify(rqstp, &argp->fh, 0,
601 NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT);
603 /* Check special features of the file system. May request
604 * different read/write sizes for file systems known to have
605 * problems with large blocks */
607 struct super_block *sb = argp->fh.fh_dentry->d_sb;
609 /* Note that we don't care for remote fs's here */
610 if (sb->s_magic == MSDOS_SUPER_MAGIC) {
611 resp->f_properties = NFS3_FSF_BILLYBOY;
613 resp->f_maxfilesize = sb->s_maxbytes;
617 RETURN_STATUS(nfserr);
621 * Get pathconf info for the specified file
624 nfsd3_proc_pathconf(struct svc_rqst *rqstp)
626 struct nfsd_fhandle *argp = rqstp->rq_argp;
627 struct nfsd3_pathconfres *resp = rqstp->rq_resp;
630 dprintk("nfsd: PATHCONF(3) %s\n",
631 SVCFH_fmt(&argp->fh));
633 /* Set default pathconf */
634 resp->p_link_max = 255; /* at least */
635 resp->p_name_max = 255; /* at least */
636 resp->p_no_trunc = 0;
637 resp->p_chown_restricted = 1;
638 resp->p_case_insensitive = 0;
639 resp->p_case_preserving = 1;
641 nfserr = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP);
644 struct super_block *sb = argp->fh.fh_dentry->d_sb;
646 /* Note that we don't care for remote fs's here */
647 switch (sb->s_magic) {
648 case EXT2_SUPER_MAGIC:
649 resp->p_link_max = EXT2_LINK_MAX;
650 resp->p_name_max = EXT2_NAME_LEN;
652 case MSDOS_SUPER_MAGIC:
653 resp->p_case_insensitive = 1;
654 resp->p_case_preserving = 0;
660 RETURN_STATUS(nfserr);
665 * Commit a file (range) to stable storage.
668 nfsd3_proc_commit(struct svc_rqst *rqstp)
670 struct nfsd3_commitargs *argp = rqstp->rq_argp;
671 struct nfsd3_commitres *resp = rqstp->rq_resp;
674 dprintk("nfsd: COMMIT(3) %s %u@%Lu\n",
675 SVCFH_fmt(&argp->fh),
677 (unsigned long long) argp->offset);
679 if (argp->offset > NFS_OFFSET_MAX)
680 RETURN_STATUS(nfserr_inval);
682 fh_copy(&resp->fh, &argp->fh);
683 nfserr = nfsd_commit(rqstp, &resp->fh, argp->offset, argp->count);
685 RETURN_STATUS(nfserr);
690 * NFSv3 Server procedures.
691 * Only the results of non-idempotent operations are cached.
693 #define nfs3svc_decode_fhandleargs nfs3svc_decode_fhandle
694 #define nfs3svc_encode_attrstatres nfs3svc_encode_attrstat
695 #define nfs3svc_encode_wccstatres nfs3svc_encode_wccstat
696 #define nfsd3_mkdirargs nfsd3_createargs
697 #define nfsd3_readdirplusargs nfsd3_readdirargs
698 #define nfsd3_fhandleargs nfsd_fhandle
699 #define nfsd3_fhandleres nfsd3_attrstat
700 #define nfsd3_attrstatres nfsd3_attrstat
701 #define nfsd3_wccstatres nfsd3_attrstat
702 #define nfsd3_createres nfsd3_diropres
703 #define nfsd3_voidres nfsd3_voidargs
704 struct nfsd3_voidargs { int dummy; };
706 #define ST 1 /* status*/
707 #define FH 17 /* filehandle with length */
708 #define AT 21 /* attributes */
709 #define pAT (1+AT) /* post attributes - conditional */
710 #define WC (7+pAT) /* WCC attributes */
712 static const struct svc_procedure nfsd_procedures3[22] = {
714 .pc_func = nfsd3_proc_null,
715 .pc_encode = nfs3svc_encode_voidres,
716 .pc_argsize = sizeof(struct nfsd3_voidargs),
717 .pc_ressize = sizeof(struct nfsd3_voidres),
718 .pc_cachetype = RC_NOCACHE,
721 [NFS3PROC_GETATTR] = {
722 .pc_func = nfsd3_proc_getattr,
723 .pc_decode = nfs3svc_decode_fhandleargs,
724 .pc_encode = nfs3svc_encode_attrstatres,
725 .pc_release = nfs3svc_release_fhandle,
726 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
727 .pc_ressize = sizeof(struct nfsd3_attrstatres),
728 .pc_cachetype = RC_NOCACHE,
729 .pc_xdrressize = ST+AT,
731 [NFS3PROC_SETATTR] = {
732 .pc_func = nfsd3_proc_setattr,
733 .pc_decode = nfs3svc_decode_sattrargs,
734 .pc_encode = nfs3svc_encode_wccstatres,
735 .pc_release = nfs3svc_release_fhandle,
736 .pc_argsize = sizeof(struct nfsd3_sattrargs),
737 .pc_ressize = sizeof(struct nfsd3_wccstatres),
738 .pc_cachetype = RC_REPLBUFF,
739 .pc_xdrressize = ST+WC,
741 [NFS3PROC_LOOKUP] = {
742 .pc_func = nfsd3_proc_lookup,
743 .pc_decode = nfs3svc_decode_diropargs,
744 .pc_encode = nfs3svc_encode_diropres,
745 .pc_release = nfs3svc_release_fhandle2,
746 .pc_argsize = sizeof(struct nfsd3_diropargs),
747 .pc_ressize = sizeof(struct nfsd3_diropres),
748 .pc_cachetype = RC_NOCACHE,
749 .pc_xdrressize = ST+FH+pAT+pAT,
751 [NFS3PROC_ACCESS] = {
752 .pc_func = nfsd3_proc_access,
753 .pc_decode = nfs3svc_decode_accessargs,
754 .pc_encode = nfs3svc_encode_accessres,
755 .pc_release = nfs3svc_release_fhandle,
756 .pc_argsize = sizeof(struct nfsd3_accessargs),
757 .pc_ressize = sizeof(struct nfsd3_accessres),
758 .pc_cachetype = RC_NOCACHE,
759 .pc_xdrressize = ST+pAT+1,
761 [NFS3PROC_READLINK] = {
762 .pc_func = nfsd3_proc_readlink,
763 .pc_decode = nfs3svc_decode_readlinkargs,
764 .pc_encode = nfs3svc_encode_readlinkres,
765 .pc_release = nfs3svc_release_fhandle,
766 .pc_argsize = sizeof(struct nfsd3_readlinkargs),
767 .pc_ressize = sizeof(struct nfsd3_readlinkres),
768 .pc_cachetype = RC_NOCACHE,
769 .pc_xdrressize = ST+pAT+1+NFS3_MAXPATHLEN/4,
772 .pc_func = nfsd3_proc_read,
773 .pc_decode = nfs3svc_decode_readargs,
774 .pc_encode = nfs3svc_encode_readres,
775 .pc_release = nfs3svc_release_fhandle,
776 .pc_argsize = sizeof(struct nfsd3_readargs),
777 .pc_ressize = sizeof(struct nfsd3_readres),
778 .pc_cachetype = RC_NOCACHE,
779 .pc_xdrressize = ST+pAT+4+NFSSVC_MAXBLKSIZE/4,
782 .pc_func = nfsd3_proc_write,
783 .pc_decode = nfs3svc_decode_writeargs,
784 .pc_encode = nfs3svc_encode_writeres,
785 .pc_release = nfs3svc_release_fhandle,
786 .pc_argsize = sizeof(struct nfsd3_writeargs),
787 .pc_ressize = sizeof(struct nfsd3_writeres),
788 .pc_cachetype = RC_REPLBUFF,
789 .pc_xdrressize = ST+WC+4,
791 [NFS3PROC_CREATE] = {
792 .pc_func = nfsd3_proc_create,
793 .pc_decode = nfs3svc_decode_createargs,
794 .pc_encode = nfs3svc_encode_createres,
795 .pc_release = nfs3svc_release_fhandle2,
796 .pc_argsize = sizeof(struct nfsd3_createargs),
797 .pc_ressize = sizeof(struct nfsd3_createres),
798 .pc_cachetype = RC_REPLBUFF,
799 .pc_xdrressize = ST+(1+FH+pAT)+WC,
802 .pc_func = nfsd3_proc_mkdir,
803 .pc_decode = nfs3svc_decode_mkdirargs,
804 .pc_encode = nfs3svc_encode_createres,
805 .pc_release = nfs3svc_release_fhandle2,
806 .pc_argsize = sizeof(struct nfsd3_mkdirargs),
807 .pc_ressize = sizeof(struct nfsd3_createres),
808 .pc_cachetype = RC_REPLBUFF,
809 .pc_xdrressize = ST+(1+FH+pAT)+WC,
811 [NFS3PROC_SYMLINK] = {
812 .pc_func = nfsd3_proc_symlink,
813 .pc_decode = nfs3svc_decode_symlinkargs,
814 .pc_encode = nfs3svc_encode_createres,
815 .pc_release = nfs3svc_release_fhandle2,
816 .pc_argsize = sizeof(struct nfsd3_symlinkargs),
817 .pc_ressize = sizeof(struct nfsd3_createres),
818 .pc_cachetype = RC_REPLBUFF,
819 .pc_xdrressize = ST+(1+FH+pAT)+WC,
822 .pc_func = nfsd3_proc_mknod,
823 .pc_decode = nfs3svc_decode_mknodargs,
824 .pc_encode = nfs3svc_encode_createres,
825 .pc_release = nfs3svc_release_fhandle2,
826 .pc_argsize = sizeof(struct nfsd3_mknodargs),
827 .pc_ressize = sizeof(struct nfsd3_createres),
828 .pc_cachetype = RC_REPLBUFF,
829 .pc_xdrressize = ST+(1+FH+pAT)+WC,
831 [NFS3PROC_REMOVE] = {
832 .pc_func = nfsd3_proc_remove,
833 .pc_decode = nfs3svc_decode_diropargs,
834 .pc_encode = nfs3svc_encode_wccstatres,
835 .pc_release = nfs3svc_release_fhandle,
836 .pc_argsize = sizeof(struct nfsd3_diropargs),
837 .pc_ressize = sizeof(struct nfsd3_wccstatres),
838 .pc_cachetype = RC_REPLBUFF,
839 .pc_xdrressize = ST+WC,
842 .pc_func = nfsd3_proc_rmdir,
843 .pc_decode = nfs3svc_decode_diropargs,
844 .pc_encode = nfs3svc_encode_wccstatres,
845 .pc_release = nfs3svc_release_fhandle,
846 .pc_argsize = sizeof(struct nfsd3_diropargs),
847 .pc_ressize = sizeof(struct nfsd3_wccstatres),
848 .pc_cachetype = RC_REPLBUFF,
849 .pc_xdrressize = ST+WC,
851 [NFS3PROC_RENAME] = {
852 .pc_func = nfsd3_proc_rename,
853 .pc_decode = nfs3svc_decode_renameargs,
854 .pc_encode = nfs3svc_encode_renameres,
855 .pc_release = nfs3svc_release_fhandle2,
856 .pc_argsize = sizeof(struct nfsd3_renameargs),
857 .pc_ressize = sizeof(struct nfsd3_renameres),
858 .pc_cachetype = RC_REPLBUFF,
859 .pc_xdrressize = ST+WC+WC,
862 .pc_func = nfsd3_proc_link,
863 .pc_decode = nfs3svc_decode_linkargs,
864 .pc_encode = nfs3svc_encode_linkres,
865 .pc_release = nfs3svc_release_fhandle2,
866 .pc_argsize = sizeof(struct nfsd3_linkargs),
867 .pc_ressize = sizeof(struct nfsd3_linkres),
868 .pc_cachetype = RC_REPLBUFF,
869 .pc_xdrressize = ST+pAT+WC,
871 [NFS3PROC_READDIR] = {
872 .pc_func = nfsd3_proc_readdir,
873 .pc_decode = nfs3svc_decode_readdirargs,
874 .pc_encode = nfs3svc_encode_readdirres,
875 .pc_release = nfs3svc_release_fhandle,
876 .pc_argsize = sizeof(struct nfsd3_readdirargs),
877 .pc_ressize = sizeof(struct nfsd3_readdirres),
878 .pc_cachetype = RC_NOCACHE,
880 [NFS3PROC_READDIRPLUS] = {
881 .pc_func = nfsd3_proc_readdirplus,
882 .pc_decode = nfs3svc_decode_readdirplusargs,
883 .pc_encode = nfs3svc_encode_readdirres,
884 .pc_release = nfs3svc_release_fhandle,
885 .pc_argsize = sizeof(struct nfsd3_readdirplusargs),
886 .pc_ressize = sizeof(struct nfsd3_readdirres),
887 .pc_cachetype = RC_NOCACHE,
889 [NFS3PROC_FSSTAT] = {
890 .pc_func = nfsd3_proc_fsstat,
891 .pc_decode = nfs3svc_decode_fhandleargs,
892 .pc_encode = nfs3svc_encode_fsstatres,
893 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
894 .pc_ressize = sizeof(struct nfsd3_fsstatres),
895 .pc_cachetype = RC_NOCACHE,
896 .pc_xdrressize = ST+pAT+2*6+1,
898 [NFS3PROC_FSINFO] = {
899 .pc_func = nfsd3_proc_fsinfo,
900 .pc_decode = nfs3svc_decode_fhandleargs,
901 .pc_encode = nfs3svc_encode_fsinfores,
902 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
903 .pc_ressize = sizeof(struct nfsd3_fsinfores),
904 .pc_cachetype = RC_NOCACHE,
905 .pc_xdrressize = ST+pAT+12,
907 [NFS3PROC_PATHCONF] = {
908 .pc_func = nfsd3_proc_pathconf,
909 .pc_decode = nfs3svc_decode_fhandleargs,
910 .pc_encode = nfs3svc_encode_pathconfres,
911 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
912 .pc_ressize = sizeof(struct nfsd3_pathconfres),
913 .pc_cachetype = RC_NOCACHE,
914 .pc_xdrressize = ST+pAT+6,
916 [NFS3PROC_COMMIT] = {
917 .pc_func = nfsd3_proc_commit,
918 .pc_decode = nfs3svc_decode_commitargs,
919 .pc_encode = nfs3svc_encode_commitres,
920 .pc_release = nfs3svc_release_fhandle,
921 .pc_argsize = sizeof(struct nfsd3_commitargs),
922 .pc_ressize = sizeof(struct nfsd3_commitres),
923 .pc_cachetype = RC_NOCACHE,
924 .pc_xdrressize = ST+WC+2,
928 static unsigned int nfsd_count3[ARRAY_SIZE(nfsd_procedures3)];
929 const struct svc_version nfsd_version3 = {
932 .vs_proc = nfsd_procedures3,
933 .vs_dispatch = nfsd_dispatch,
934 .vs_count = nfsd_count3,
935 .vs_xdrsize = NFS3_SVC_XDRSIZE,