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>
11 #include <linux/namei.h>
17 #define NFSDDBG_FACILITY NFSDDBG_PROC
19 static int nfs3_ftypes[] = {
26 S_IFSOCK, /* NF3SOCK */
27 S_IFIFO, /* NF3FIFO */
34 nfsd3_proc_null(struct svc_rqst *rqstp)
40 * Get a file's attributes
43 nfsd3_proc_getattr(struct svc_rqst *rqstp)
45 struct nfsd_fhandle *argp = rqstp->rq_argp;
46 struct nfsd3_attrstat *resp = rqstp->rq_resp;
48 dprintk("nfsd: GETATTR(3) %s\n",
49 SVCFH_fmt(&argp->fh));
51 fh_copy(&resp->fh, &argp->fh);
52 resp->status = fh_verify(rqstp, &resp->fh, 0,
53 NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT);
54 if (resp->status != nfs_ok)
57 resp->status = fh_getattr(&resp->fh, &resp->stat);
63 * Set a file's attributes
66 nfsd3_proc_setattr(struct svc_rqst *rqstp)
68 struct nfsd3_sattrargs *argp = rqstp->rq_argp;
69 struct nfsd3_attrstat *resp = rqstp->rq_resp;
70 struct nfsd_attrs attrs = {
71 .na_iattr = &argp->attrs,
74 dprintk("nfsd: SETATTR(3) %s\n",
75 SVCFH_fmt(&argp->fh));
77 fh_copy(&resp->fh, &argp->fh);
78 resp->status = nfsd_setattr(rqstp, &resp->fh, &attrs,
79 argp->check_guard, argp->guardtime);
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;
92 dprintk("nfsd: LOOKUP(3) %s %.*s\n",
97 fh_copy(&resp->dirfh, &argp->fh);
98 fh_init(&resp->fh, NFS3_FHSIZE);
100 resp->status = nfsd_lookup(rqstp, &resp->dirfh,
101 argp->name, argp->len,
110 nfsd3_proc_access(struct svc_rqst *rqstp)
112 struct nfsd3_accessargs *argp = rqstp->rq_argp;
113 struct nfsd3_accessres *resp = rqstp->rq_resp;
115 dprintk("nfsd: ACCESS(3) %s 0x%x\n",
116 SVCFH_fmt(&argp->fh),
119 fh_copy(&resp->fh, &argp->fh);
120 resp->access = argp->access;
121 resp->status = nfsd_access(rqstp, &resp->fh, &resp->access, NULL);
129 nfsd3_proc_readlink(struct svc_rqst *rqstp)
131 struct nfsd_fhandle *argp = rqstp->rq_argp;
132 struct nfsd3_readlinkres *resp = rqstp->rq_resp;
134 dprintk("nfsd: READLINK(3) %s\n", SVCFH_fmt(&argp->fh));
136 /* Read the symlink. */
137 fh_copy(&resp->fh, &argp->fh);
138 resp->len = NFS3_MAXPATHLEN;
139 resp->pages = rqstp->rq_next_page++;
140 resp->status = nfsd_readlink(rqstp, &resp->fh,
141 page_address(*resp->pages), &resp->len);
146 * Read a portion of a file.
149 nfsd3_proc_read(struct svc_rqst *rqstp)
151 struct nfsd3_readargs *argp = rqstp->rq_argp;
152 struct nfsd3_readres *resp = rqstp->rq_resp;
153 u32 max_blocksize = svc_max_payload(rqstp);
157 dprintk("nfsd: READ(3) %s %lu bytes at %Lu\n",
158 SVCFH_fmt(&argp->fh),
159 (unsigned long) argp->count,
160 (unsigned long long) argp->offset);
162 argp->count = min_t(u32, argp->count, max_blocksize);
163 if (argp->offset > (u64)OFFSET_MAX)
164 argp->offset = (u64)OFFSET_MAX;
165 if (argp->offset + argp->count > (u64)OFFSET_MAX)
166 argp->count = (u64)OFFSET_MAX - argp->offset;
170 resp->pages = rqstp->rq_next_page;
172 struct page *page = *(rqstp->rq_next_page++);
174 rqstp->rq_vec[v].iov_base = page_address(page);
175 rqstp->rq_vec[v].iov_len = min_t(unsigned int, len, PAGE_SIZE);
176 len -= rqstp->rq_vec[v].iov_len;
180 /* Obtain buffer pointer for payload.
181 * 1 (status) + 22 (post_op_attr) + 1 (count) + 1 (eof)
182 * + 1 (xdr opaque byte count) = 26
184 resp->count = argp->count;
185 svc_reserve_auth(rqstp, ((1 + NFS3_POST_OP_ATTR_WORDS + 3)<<2) + resp->count +4);
187 fh_copy(&resp->fh, &argp->fh);
188 resp->status = nfsd_read(rqstp, &resp->fh, argp->offset,
189 rqstp->rq_vec, v, &resp->count, &resp->eof);
194 * Write data to a file
197 nfsd3_proc_write(struct svc_rqst *rqstp)
199 struct nfsd3_writeargs *argp = rqstp->rq_argp;
200 struct nfsd3_writeres *resp = rqstp->rq_resp;
201 unsigned long cnt = argp->len;
204 dprintk("nfsd: WRITE(3) %s %d bytes at %Lu%s\n",
205 SVCFH_fmt(&argp->fh),
207 (unsigned long long) argp->offset,
208 argp->stable? " stable" : "");
210 resp->status = nfserr_fbig;
211 if (argp->offset > (u64)OFFSET_MAX ||
212 argp->offset + argp->len > (u64)OFFSET_MAX)
215 fh_copy(&resp->fh, &argp->fh);
216 resp->committed = argp->stable;
217 nvecs = svc_fill_write_vector(rqstp, &argp->payload);
219 resp->status = nfsd_write(rqstp, &resp->fh, argp->offset,
220 rqstp->rq_vec, nvecs, &cnt,
221 resp->committed, resp->verf);
227 * Implement NFSv3's unchecked, guarded, and exclusive CREATE
228 * semantics for regular files. Except for the created file,
229 * this operation is stateless on the server.
231 * Upon return, caller must release @fhp and @resfhp.
234 nfsd3_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp,
235 struct svc_fh *resfhp, struct nfsd3_createargs *argp)
237 struct iattr *iap = &argp->attrs;
238 struct dentry *parent, *child;
239 struct nfsd_attrs attrs = {
242 __u32 v_mtime, v_atime;
247 if (isdotent(argp->name, argp->len))
249 if (!(iap->ia_valid & ATTR_MODE))
252 status = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_EXEC);
253 if (status != nfs_ok)
256 parent = fhp->fh_dentry;
257 inode = d_inode(parent);
259 host_err = fh_want_write(fhp);
261 return nfserrno(host_err);
263 inode_lock_nested(inode, I_MUTEX_PARENT);
265 child = lookup_one_len(argp->name, parent, argp->len);
267 status = nfserrno(PTR_ERR(child));
271 if (d_really_is_negative(child)) {
272 status = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_CREATE);
273 if (status != nfs_ok)
277 status = fh_compose(resfhp, fhp->fh_export, child, fhp);
278 if (status != nfs_ok)
283 if (argp->createmode == NFS3_CREATE_EXCLUSIVE) {
284 u32 *verifier = (u32 *)argp->verf;
287 * Solaris 7 gets confused (bugid 4218508) if these have
288 * the high bit set, as do xfs filesystems without the
289 * "bigtime" feature. So just clear the high bits.
291 v_mtime = verifier[0] & 0x7fffffff;
292 v_atime = verifier[1] & 0x7fffffff;
295 if (d_really_is_positive(child)) {
298 switch (argp->createmode) {
299 case NFS3_CREATE_UNCHECKED:
300 if (!d_is_reg(child))
302 iap->ia_valid &= ATTR_SIZE;
304 case NFS3_CREATE_GUARDED:
305 status = nfserr_exist;
307 case NFS3_CREATE_EXCLUSIVE:
308 if (d_inode(child)->i_mtime.tv_sec == v_mtime &&
309 d_inode(child)->i_atime.tv_sec == v_atime &&
310 d_inode(child)->i_size == 0) {
313 status = nfserr_exist;
318 if (!IS_POSIXACL(inode))
319 iap->ia_mode &= ~current_umask();
321 fh_fill_pre_attrs(fhp);
322 host_err = vfs_create(&init_user_ns, inode, child, iap->ia_mode, true);
324 status = nfserrno(host_err);
327 fh_fill_post_attrs(fhp);
329 /* A newly created file already has a file size of zero. */
330 if ((iap->ia_valid & ATTR_SIZE) && (iap->ia_size == 0))
331 iap->ia_valid &= ~ATTR_SIZE;
332 if (argp->createmode == NFS3_CREATE_EXCLUSIVE) {
333 iap->ia_valid = ATTR_MTIME | ATTR_ATIME |
334 ATTR_MTIME_SET | ATTR_ATIME_SET;
335 iap->ia_mtime.tv_sec = v_mtime;
336 iap->ia_atime.tv_sec = v_atime;
337 iap->ia_mtime.tv_nsec = 0;
338 iap->ia_atime.tv_nsec = 0;
342 status = nfsd_create_setattr(rqstp, fhp, resfhp, &attrs);
346 if (child && !IS_ERR(child))
353 nfsd3_proc_create(struct svc_rqst *rqstp)
355 struct nfsd3_createargs *argp = rqstp->rq_argp;
356 struct nfsd3_diropres *resp = rqstp->rq_resp;
357 svc_fh *dirfhp, *newfhp;
359 dprintk("nfsd: CREATE(3) %s %.*s\n",
360 SVCFH_fmt(&argp->fh),
364 dirfhp = fh_copy(&resp->dirfh, &argp->fh);
365 newfhp = fh_init(&resp->fh, NFS3_FHSIZE);
367 resp->status = nfsd3_create_file(rqstp, dirfhp, newfhp, argp);
372 * Make directory. This operation is not idempotent.
375 nfsd3_proc_mkdir(struct svc_rqst *rqstp)
377 struct nfsd3_createargs *argp = rqstp->rq_argp;
378 struct nfsd3_diropres *resp = rqstp->rq_resp;
379 struct nfsd_attrs attrs = {
380 .na_iattr = &argp->attrs,
383 dprintk("nfsd: MKDIR(3) %s %.*s\n",
384 SVCFH_fmt(&argp->fh),
388 argp->attrs.ia_valid &= ~ATTR_SIZE;
389 fh_copy(&resp->dirfh, &argp->fh);
390 fh_init(&resp->fh, NFS3_FHSIZE);
391 resp->status = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
392 &attrs, S_IFDIR, 0, &resp->fh);
397 nfsd3_proc_symlink(struct svc_rqst *rqstp)
399 struct nfsd3_symlinkargs *argp = rqstp->rq_argp;
400 struct nfsd3_diropres *resp = rqstp->rq_resp;
401 struct nfsd_attrs attrs = {
402 .na_iattr = &argp->attrs,
405 if (argp->tlen == 0) {
406 resp->status = nfserr_inval;
409 if (argp->tlen > NFS3_MAXPATHLEN) {
410 resp->status = nfserr_nametoolong;
414 argp->tname = svc_fill_symlink_pathname(rqstp, &argp->first,
415 page_address(rqstp->rq_arg.pages[0]),
417 if (IS_ERR(argp->tname)) {
418 resp->status = nfserrno(PTR_ERR(argp->tname));
422 dprintk("nfsd: SYMLINK(3) %s %.*s -> %.*s\n",
423 SVCFH_fmt(&argp->ffh),
424 argp->flen, argp->fname,
425 argp->tlen, argp->tname);
427 fh_copy(&resp->dirfh, &argp->ffh);
428 fh_init(&resp->fh, NFS3_FHSIZE);
429 resp->status = nfsd_symlink(rqstp, &resp->dirfh, argp->fname,
430 argp->flen, argp->tname, &attrs, &resp->fh);
437 * Make socket/fifo/device.
440 nfsd3_proc_mknod(struct svc_rqst *rqstp)
442 struct nfsd3_mknodargs *argp = rqstp->rq_argp;
443 struct nfsd3_diropres *resp = rqstp->rq_resp;
444 struct nfsd_attrs attrs = {
445 .na_iattr = &argp->attrs,
450 dprintk("nfsd: MKNOD(3) %s %.*s\n",
451 SVCFH_fmt(&argp->fh),
455 fh_copy(&resp->dirfh, &argp->fh);
456 fh_init(&resp->fh, NFS3_FHSIZE);
458 if (argp->ftype == NF3CHR || argp->ftype == NF3BLK) {
459 rdev = MKDEV(argp->major, argp->minor);
460 if (MAJOR(rdev) != argp->major ||
461 MINOR(rdev) != argp->minor) {
462 resp->status = nfserr_inval;
465 } else if (argp->ftype != NF3SOCK && argp->ftype != NF3FIFO) {
466 resp->status = nfserr_badtype;
470 type = nfs3_ftypes[argp->ftype];
471 resp->status = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
472 &attrs, type, rdev, &resp->fh);
478 * Remove file/fifo/socket etc.
481 nfsd3_proc_remove(struct svc_rqst *rqstp)
483 struct nfsd3_diropargs *argp = rqstp->rq_argp;
484 struct nfsd3_attrstat *resp = rqstp->rq_resp;
486 dprintk("nfsd: REMOVE(3) %s %.*s\n",
487 SVCFH_fmt(&argp->fh),
491 /* Unlink. -S_IFDIR means file must not be a directory */
492 fh_copy(&resp->fh, &argp->fh);
493 resp->status = nfsd_unlink(rqstp, &resp->fh, -S_IFDIR,
494 argp->name, argp->len);
502 nfsd3_proc_rmdir(struct svc_rqst *rqstp)
504 struct nfsd3_diropargs *argp = rqstp->rq_argp;
505 struct nfsd3_attrstat *resp = rqstp->rq_resp;
507 dprintk("nfsd: RMDIR(3) %s %.*s\n",
508 SVCFH_fmt(&argp->fh),
512 fh_copy(&resp->fh, &argp->fh);
513 resp->status = nfsd_unlink(rqstp, &resp->fh, S_IFDIR,
514 argp->name, argp->len);
519 nfsd3_proc_rename(struct svc_rqst *rqstp)
521 struct nfsd3_renameargs *argp = rqstp->rq_argp;
522 struct nfsd3_renameres *resp = rqstp->rq_resp;
524 dprintk("nfsd: RENAME(3) %s %.*s ->\n",
525 SVCFH_fmt(&argp->ffh),
528 dprintk("nfsd: -> %s %.*s\n",
529 SVCFH_fmt(&argp->tfh),
533 fh_copy(&resp->ffh, &argp->ffh);
534 fh_copy(&resp->tfh, &argp->tfh);
535 resp->status = nfsd_rename(rqstp, &resp->ffh, argp->fname, argp->flen,
536 &resp->tfh, argp->tname, argp->tlen);
541 nfsd3_proc_link(struct svc_rqst *rqstp)
543 struct nfsd3_linkargs *argp = rqstp->rq_argp;
544 struct nfsd3_linkres *resp = rqstp->rq_resp;
546 dprintk("nfsd: LINK(3) %s ->\n",
547 SVCFH_fmt(&argp->ffh));
548 dprintk("nfsd: -> %s %.*s\n",
549 SVCFH_fmt(&argp->tfh),
553 fh_copy(&resp->fh, &argp->ffh);
554 fh_copy(&resp->tfh, &argp->tfh);
555 resp->status = nfsd_link(rqstp, &resp->tfh, argp->tname, argp->tlen,
560 static void nfsd3_init_dirlist_pages(struct svc_rqst *rqstp,
561 struct nfsd3_readdirres *resp,
564 struct xdr_buf *buf = &resp->dirlist;
565 struct xdr_stream *xdr = &resp->xdr;
567 count = clamp(count, (u32)(XDR_UNIT * 2), svc_max_payload(rqstp));
569 memset(buf, 0, sizeof(*buf));
571 /* Reserve room for the NULL ptr & eof flag (-2 words) */
572 buf->buflen = count - XDR_UNIT * 2;
573 buf->pages = rqstp->rq_next_page;
574 rqstp->rq_next_page += (buf->buflen + PAGE_SIZE - 1) >> PAGE_SHIFT;
576 /* This is xdr_init_encode(), but it assumes that
577 * the head kvec has already been consumed. */
578 xdr_set_scratch_buffer(xdr, NULL, 0);
580 xdr->page_ptr = buf->pages;
582 xdr->p = page_address(*buf->pages);
583 xdr->end = (void *)xdr->p + min_t(u32, buf->buflen, PAGE_SIZE);
588 * Read a portion of a directory.
591 nfsd3_proc_readdir(struct svc_rqst *rqstp)
593 struct nfsd3_readdirargs *argp = rqstp->rq_argp;
594 struct nfsd3_readdirres *resp = rqstp->rq_resp;
597 dprintk("nfsd: READDIR(3) %s %d bytes at %d\n",
598 SVCFH_fmt(&argp->fh),
599 argp->count, (u32) argp->cookie);
601 nfsd3_init_dirlist_pages(rqstp, resp, argp->count);
603 fh_copy(&resp->fh, &argp->fh);
604 resp->common.err = nfs_ok;
605 resp->cookie_offset = 0;
607 offset = argp->cookie;
608 resp->status = nfsd_readdir(rqstp, &resp->fh, &offset,
609 &resp->common, nfs3svc_encode_entry3);
610 memcpy(resp->verf, argp->verf, 8);
611 nfs3svc_encode_cookie3(resp, offset);
613 /* Recycle only pages that were part of the reply */
614 rqstp->rq_next_page = resp->xdr.page_ptr + 1;
620 * Read a portion of a directory, including file handles and attrs.
621 * For now, we choose to ignore the dircount parameter.
624 nfsd3_proc_readdirplus(struct svc_rqst *rqstp)
626 struct nfsd3_readdirargs *argp = rqstp->rq_argp;
627 struct nfsd3_readdirres *resp = rqstp->rq_resp;
630 dprintk("nfsd: READDIR+(3) %s %d bytes at %d\n",
631 SVCFH_fmt(&argp->fh),
632 argp->count, (u32) argp->cookie);
634 nfsd3_init_dirlist_pages(rqstp, resp, argp->count);
636 fh_copy(&resp->fh, &argp->fh);
637 resp->common.err = nfs_ok;
638 resp->cookie_offset = 0;
640 offset = argp->cookie;
642 resp->status = fh_verify(rqstp, &resp->fh, S_IFDIR, NFSD_MAY_NOP);
643 if (resp->status != nfs_ok)
646 if (resp->fh.fh_export->ex_flags & NFSEXP_NOREADDIRPLUS) {
647 resp->status = nfserr_notsupp;
651 resp->status = nfsd_readdir(rqstp, &resp->fh, &offset,
652 &resp->common, nfs3svc_encode_entryplus3);
653 memcpy(resp->verf, argp->verf, 8);
654 nfs3svc_encode_cookie3(resp, offset);
656 /* Recycle only pages that were part of the reply */
657 rqstp->rq_next_page = resp->xdr.page_ptr + 1;
664 * Get file system stats
667 nfsd3_proc_fsstat(struct svc_rqst *rqstp)
669 struct nfsd_fhandle *argp = rqstp->rq_argp;
670 struct nfsd3_fsstatres *resp = rqstp->rq_resp;
672 dprintk("nfsd: FSSTAT(3) %s\n",
673 SVCFH_fmt(&argp->fh));
675 resp->status = nfsd_statfs(rqstp, &argp->fh, &resp->stats, 0);
681 * Get file system info
684 nfsd3_proc_fsinfo(struct svc_rqst *rqstp)
686 struct nfsd_fhandle *argp = rqstp->rq_argp;
687 struct nfsd3_fsinfores *resp = rqstp->rq_resp;
688 u32 max_blocksize = svc_max_payload(rqstp);
690 dprintk("nfsd: FSINFO(3) %s\n",
691 SVCFH_fmt(&argp->fh));
693 resp->f_rtmax = max_blocksize;
694 resp->f_rtpref = max_blocksize;
695 resp->f_rtmult = PAGE_SIZE;
696 resp->f_wtmax = max_blocksize;
697 resp->f_wtpref = max_blocksize;
698 resp->f_wtmult = PAGE_SIZE;
699 resp->f_dtpref = max_blocksize;
700 resp->f_maxfilesize = ~(u32) 0;
701 resp->f_properties = NFS3_FSF_DEFAULT;
703 resp->status = fh_verify(rqstp, &argp->fh, 0,
704 NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT);
706 /* Check special features of the file system. May request
707 * different read/write sizes for file systems known to have
708 * problems with large blocks */
709 if (resp->status == nfs_ok) {
710 struct super_block *sb = argp->fh.fh_dentry->d_sb;
712 /* Note that we don't care for remote fs's here */
713 if (sb->s_magic == MSDOS_SUPER_MAGIC) {
714 resp->f_properties = NFS3_FSF_BILLYBOY;
716 resp->f_maxfilesize = sb->s_maxbytes;
724 * Get pathconf info for the specified file
727 nfsd3_proc_pathconf(struct svc_rqst *rqstp)
729 struct nfsd_fhandle *argp = rqstp->rq_argp;
730 struct nfsd3_pathconfres *resp = rqstp->rq_resp;
732 dprintk("nfsd: PATHCONF(3) %s\n",
733 SVCFH_fmt(&argp->fh));
735 /* Set default pathconf */
736 resp->p_link_max = 255; /* at least */
737 resp->p_name_max = 255; /* at least */
738 resp->p_no_trunc = 0;
739 resp->p_chown_restricted = 1;
740 resp->p_case_insensitive = 0;
741 resp->p_case_preserving = 1;
743 resp->status = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP);
745 if (resp->status == nfs_ok) {
746 struct super_block *sb = argp->fh.fh_dentry->d_sb;
748 /* Note that we don't care for remote fs's here */
749 switch (sb->s_magic) {
750 case EXT2_SUPER_MAGIC:
751 resp->p_link_max = EXT2_LINK_MAX;
752 resp->p_name_max = EXT2_NAME_LEN;
754 case MSDOS_SUPER_MAGIC:
755 resp->p_case_insensitive = 1;
756 resp->p_case_preserving = 0;
766 * Commit a file (range) to stable storage.
769 nfsd3_proc_commit(struct svc_rqst *rqstp)
771 struct nfsd3_commitargs *argp = rqstp->rq_argp;
772 struct nfsd3_commitres *resp = rqstp->rq_resp;
774 dprintk("nfsd: COMMIT(3) %s %u@%Lu\n",
775 SVCFH_fmt(&argp->fh),
777 (unsigned long long) argp->offset);
779 fh_copy(&resp->fh, &argp->fh);
780 resp->status = nfsd_commit(rqstp, &resp->fh, argp->offset,
781 argp->count, resp->verf);
787 * NFSv3 Server procedures.
788 * Only the results of non-idempotent operations are cached.
790 #define nfs3svc_encode_attrstatres nfs3svc_encode_attrstat
791 #define nfs3svc_encode_wccstatres nfs3svc_encode_wccstat
792 #define nfsd3_mkdirargs nfsd3_createargs
793 #define nfsd3_readdirplusargs nfsd3_readdirargs
794 #define nfsd3_fhandleargs nfsd_fhandle
795 #define nfsd3_attrstatres nfsd3_attrstat
796 #define nfsd3_wccstatres nfsd3_attrstat
797 #define nfsd3_createres nfsd3_diropres
799 #define ST 1 /* status*/
800 #define FH 17 /* filehandle with length */
801 #define AT 21 /* attributes */
802 #define pAT (1+AT) /* post attributes - conditional */
803 #define WC (7+pAT) /* WCC attributes */
805 static const struct svc_procedure nfsd_procedures3[22] = {
807 .pc_func = nfsd3_proc_null,
808 .pc_decode = nfssvc_decode_voidarg,
809 .pc_encode = nfssvc_encode_voidres,
810 .pc_argsize = sizeof(struct nfsd_voidargs),
811 .pc_ressize = sizeof(struct nfsd_voidres),
812 .pc_cachetype = RC_NOCACHE,
816 [NFS3PROC_GETATTR] = {
817 .pc_func = nfsd3_proc_getattr,
818 .pc_decode = nfs3svc_decode_fhandleargs,
819 .pc_encode = nfs3svc_encode_getattrres,
820 .pc_release = nfs3svc_release_fhandle,
821 .pc_argsize = sizeof(struct nfsd_fhandle),
822 .pc_ressize = sizeof(struct nfsd3_attrstatres),
823 .pc_cachetype = RC_NOCACHE,
824 .pc_xdrressize = ST+AT,
825 .pc_name = "GETATTR",
827 [NFS3PROC_SETATTR] = {
828 .pc_func = nfsd3_proc_setattr,
829 .pc_decode = nfs3svc_decode_sattrargs,
830 .pc_encode = nfs3svc_encode_wccstatres,
831 .pc_release = nfs3svc_release_fhandle,
832 .pc_argsize = sizeof(struct nfsd3_sattrargs),
833 .pc_ressize = sizeof(struct nfsd3_wccstatres),
834 .pc_cachetype = RC_REPLBUFF,
835 .pc_xdrressize = ST+WC,
836 .pc_name = "SETATTR",
838 [NFS3PROC_LOOKUP] = {
839 .pc_func = nfsd3_proc_lookup,
840 .pc_decode = nfs3svc_decode_diropargs,
841 .pc_encode = nfs3svc_encode_lookupres,
842 .pc_release = nfs3svc_release_fhandle2,
843 .pc_argsize = sizeof(struct nfsd3_diropargs),
844 .pc_ressize = sizeof(struct nfsd3_diropres),
845 .pc_cachetype = RC_NOCACHE,
846 .pc_xdrressize = ST+FH+pAT+pAT,
849 [NFS3PROC_ACCESS] = {
850 .pc_func = nfsd3_proc_access,
851 .pc_decode = nfs3svc_decode_accessargs,
852 .pc_encode = nfs3svc_encode_accessres,
853 .pc_release = nfs3svc_release_fhandle,
854 .pc_argsize = sizeof(struct nfsd3_accessargs),
855 .pc_ressize = sizeof(struct nfsd3_accessres),
856 .pc_cachetype = RC_NOCACHE,
857 .pc_xdrressize = ST+pAT+1,
860 [NFS3PROC_READLINK] = {
861 .pc_func = nfsd3_proc_readlink,
862 .pc_decode = nfs3svc_decode_fhandleargs,
863 .pc_encode = nfs3svc_encode_readlinkres,
864 .pc_release = nfs3svc_release_fhandle,
865 .pc_argsize = sizeof(struct nfsd_fhandle),
866 .pc_ressize = sizeof(struct nfsd3_readlinkres),
867 .pc_cachetype = RC_NOCACHE,
868 .pc_xdrressize = ST+pAT+1+NFS3_MAXPATHLEN/4,
869 .pc_name = "READLINK",
872 .pc_func = nfsd3_proc_read,
873 .pc_decode = nfs3svc_decode_readargs,
874 .pc_encode = nfs3svc_encode_readres,
875 .pc_release = nfs3svc_release_fhandle,
876 .pc_argsize = sizeof(struct nfsd3_readargs),
877 .pc_ressize = sizeof(struct nfsd3_readres),
878 .pc_cachetype = RC_NOCACHE,
879 .pc_xdrressize = ST+pAT+4+NFSSVC_MAXBLKSIZE/4,
883 .pc_func = nfsd3_proc_write,
884 .pc_decode = nfs3svc_decode_writeargs,
885 .pc_encode = nfs3svc_encode_writeres,
886 .pc_release = nfs3svc_release_fhandle,
887 .pc_argsize = sizeof(struct nfsd3_writeargs),
888 .pc_ressize = sizeof(struct nfsd3_writeres),
889 .pc_cachetype = RC_REPLBUFF,
890 .pc_xdrressize = ST+WC+4,
893 [NFS3PROC_CREATE] = {
894 .pc_func = nfsd3_proc_create,
895 .pc_decode = nfs3svc_decode_createargs,
896 .pc_encode = nfs3svc_encode_createres,
897 .pc_release = nfs3svc_release_fhandle2,
898 .pc_argsize = sizeof(struct nfsd3_createargs),
899 .pc_ressize = sizeof(struct nfsd3_createres),
900 .pc_cachetype = RC_REPLBUFF,
901 .pc_xdrressize = ST+(1+FH+pAT)+WC,
905 .pc_func = nfsd3_proc_mkdir,
906 .pc_decode = nfs3svc_decode_mkdirargs,
907 .pc_encode = nfs3svc_encode_createres,
908 .pc_release = nfs3svc_release_fhandle2,
909 .pc_argsize = sizeof(struct nfsd3_mkdirargs),
910 .pc_ressize = sizeof(struct nfsd3_createres),
911 .pc_cachetype = RC_REPLBUFF,
912 .pc_xdrressize = ST+(1+FH+pAT)+WC,
915 [NFS3PROC_SYMLINK] = {
916 .pc_func = nfsd3_proc_symlink,
917 .pc_decode = nfs3svc_decode_symlinkargs,
918 .pc_encode = nfs3svc_encode_createres,
919 .pc_release = nfs3svc_release_fhandle2,
920 .pc_argsize = sizeof(struct nfsd3_symlinkargs),
921 .pc_ressize = sizeof(struct nfsd3_createres),
922 .pc_cachetype = RC_REPLBUFF,
923 .pc_xdrressize = ST+(1+FH+pAT)+WC,
924 .pc_name = "SYMLINK",
927 .pc_func = nfsd3_proc_mknod,
928 .pc_decode = nfs3svc_decode_mknodargs,
929 .pc_encode = nfs3svc_encode_createres,
930 .pc_release = nfs3svc_release_fhandle2,
931 .pc_argsize = sizeof(struct nfsd3_mknodargs),
932 .pc_ressize = sizeof(struct nfsd3_createres),
933 .pc_cachetype = RC_REPLBUFF,
934 .pc_xdrressize = ST+(1+FH+pAT)+WC,
937 [NFS3PROC_REMOVE] = {
938 .pc_func = nfsd3_proc_remove,
939 .pc_decode = nfs3svc_decode_diropargs,
940 .pc_encode = nfs3svc_encode_wccstatres,
941 .pc_release = nfs3svc_release_fhandle,
942 .pc_argsize = sizeof(struct nfsd3_diropargs),
943 .pc_ressize = sizeof(struct nfsd3_wccstatres),
944 .pc_cachetype = RC_REPLBUFF,
945 .pc_xdrressize = ST+WC,
949 .pc_func = nfsd3_proc_rmdir,
950 .pc_decode = nfs3svc_decode_diropargs,
951 .pc_encode = nfs3svc_encode_wccstatres,
952 .pc_release = nfs3svc_release_fhandle,
953 .pc_argsize = sizeof(struct nfsd3_diropargs),
954 .pc_ressize = sizeof(struct nfsd3_wccstatres),
955 .pc_cachetype = RC_REPLBUFF,
956 .pc_xdrressize = ST+WC,
959 [NFS3PROC_RENAME] = {
960 .pc_func = nfsd3_proc_rename,
961 .pc_decode = nfs3svc_decode_renameargs,
962 .pc_encode = nfs3svc_encode_renameres,
963 .pc_release = nfs3svc_release_fhandle2,
964 .pc_argsize = sizeof(struct nfsd3_renameargs),
965 .pc_ressize = sizeof(struct nfsd3_renameres),
966 .pc_cachetype = RC_REPLBUFF,
967 .pc_xdrressize = ST+WC+WC,
971 .pc_func = nfsd3_proc_link,
972 .pc_decode = nfs3svc_decode_linkargs,
973 .pc_encode = nfs3svc_encode_linkres,
974 .pc_release = nfs3svc_release_fhandle2,
975 .pc_argsize = sizeof(struct nfsd3_linkargs),
976 .pc_ressize = sizeof(struct nfsd3_linkres),
977 .pc_cachetype = RC_REPLBUFF,
978 .pc_xdrressize = ST+pAT+WC,
981 [NFS3PROC_READDIR] = {
982 .pc_func = nfsd3_proc_readdir,
983 .pc_decode = nfs3svc_decode_readdirargs,
984 .pc_encode = nfs3svc_encode_readdirres,
985 .pc_release = nfs3svc_release_fhandle,
986 .pc_argsize = sizeof(struct nfsd3_readdirargs),
987 .pc_ressize = sizeof(struct nfsd3_readdirres),
988 .pc_cachetype = RC_NOCACHE,
989 .pc_name = "READDIR",
991 [NFS3PROC_READDIRPLUS] = {
992 .pc_func = nfsd3_proc_readdirplus,
993 .pc_decode = nfs3svc_decode_readdirplusargs,
994 .pc_encode = nfs3svc_encode_readdirres,
995 .pc_release = nfs3svc_release_fhandle,
996 .pc_argsize = sizeof(struct nfsd3_readdirplusargs),
997 .pc_ressize = sizeof(struct nfsd3_readdirres),
998 .pc_cachetype = RC_NOCACHE,
999 .pc_name = "READDIRPLUS",
1001 [NFS3PROC_FSSTAT] = {
1002 .pc_func = nfsd3_proc_fsstat,
1003 .pc_decode = nfs3svc_decode_fhandleargs,
1004 .pc_encode = nfs3svc_encode_fsstatres,
1005 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
1006 .pc_ressize = sizeof(struct nfsd3_fsstatres),
1007 .pc_cachetype = RC_NOCACHE,
1008 .pc_xdrressize = ST+pAT+2*6+1,
1009 .pc_name = "FSSTAT",
1011 [NFS3PROC_FSINFO] = {
1012 .pc_func = nfsd3_proc_fsinfo,
1013 .pc_decode = nfs3svc_decode_fhandleargs,
1014 .pc_encode = nfs3svc_encode_fsinfores,
1015 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
1016 .pc_ressize = sizeof(struct nfsd3_fsinfores),
1017 .pc_cachetype = RC_NOCACHE,
1018 .pc_xdrressize = ST+pAT+12,
1019 .pc_name = "FSINFO",
1021 [NFS3PROC_PATHCONF] = {
1022 .pc_func = nfsd3_proc_pathconf,
1023 .pc_decode = nfs3svc_decode_fhandleargs,
1024 .pc_encode = nfs3svc_encode_pathconfres,
1025 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
1026 .pc_ressize = sizeof(struct nfsd3_pathconfres),
1027 .pc_cachetype = RC_NOCACHE,
1028 .pc_xdrressize = ST+pAT+6,
1029 .pc_name = "PATHCONF",
1031 [NFS3PROC_COMMIT] = {
1032 .pc_func = nfsd3_proc_commit,
1033 .pc_decode = nfs3svc_decode_commitargs,
1034 .pc_encode = nfs3svc_encode_commitres,
1035 .pc_release = nfs3svc_release_fhandle,
1036 .pc_argsize = sizeof(struct nfsd3_commitargs),
1037 .pc_ressize = sizeof(struct nfsd3_commitres),
1038 .pc_cachetype = RC_NOCACHE,
1039 .pc_xdrressize = ST+WC+2,
1040 .pc_name = "COMMIT",
1044 static unsigned int nfsd_count3[ARRAY_SIZE(nfsd_procedures3)];
1045 const struct svc_version nfsd_version3 = {
1048 .vs_proc = nfsd_procedures3,
1049 .vs_dispatch = nfsd_dispatch,
1050 .vs_count = nfsd_count3,
1051 .vs_xdrsize = NFS3_SVC_XDRSIZE,