2 * linux/fs/nfs/nfs3proc.c
4 * Client-side NFSv3 procedures stubs.
6 * Copyright (C) 1997, Olaf Kirch
10 #include <linux/errno.h>
11 #include <linux/string.h>
12 #include <linux/sunrpc/clnt.h>
13 #include <linux/slab.h>
14 #include <linux/nfs.h>
15 #include <linux/nfs3.h>
16 #include <linux/nfs_fs.h>
17 #include <linux/nfs_page.h>
18 #include <linux/lockd/bind.h>
19 #include <linux/nfs_mount.h>
24 #define NFSDBG_FACILITY NFSDBG_PROC
26 /* A wrapper to handle the EJUKEBOX and EKEYEXPIRED error messages */
28 nfs3_rpc_wrapper(struct rpc_clnt
*clnt
, struct rpc_message
*msg
, int flags
)
32 res
= rpc_call_sync(clnt
, msg
, flags
);
33 if (res
!= -EJUKEBOX
&& res
!= -EKEYEXPIRED
)
35 schedule_timeout_killable(NFS_JUKEBOX_RETRY_TIME
);
37 } while (!fatal_signal_pending(current
));
41 #define rpc_call_sync(clnt, msg, flags) nfs3_rpc_wrapper(clnt, msg, flags)
44 nfs3_async_handle_jukebox(struct rpc_task
*task
, struct inode
*inode
)
46 if (task
->tk_status
!= -EJUKEBOX
&& task
->tk_status
!= -EKEYEXPIRED
)
48 if (task
->tk_status
== -EJUKEBOX
)
49 nfs_inc_stats(inode
, NFSIOS_DELAY
);
51 rpc_restart_call(task
);
52 rpc_delay(task
, NFS_JUKEBOX_RETRY_TIME
);
57 do_proc_get_root(struct rpc_clnt
*client
, struct nfs_fh
*fhandle
,
58 struct nfs_fsinfo
*info
)
60 struct rpc_message msg
= {
61 .rpc_proc
= &nfs3_procedures
[NFS3PROC_FSINFO
],
67 dprintk("%s: call fsinfo\n", __func__
);
68 nfs_fattr_init(info
->fattr
);
69 status
= rpc_call_sync(client
, &msg
, 0);
70 dprintk("%s: reply fsinfo: %d\n", __func__
, status
);
71 if (!(info
->fattr
->valid
& NFS_ATTR_FATTR
)) {
72 msg
.rpc_proc
= &nfs3_procedures
[NFS3PROC_GETATTR
];
73 msg
.rpc_resp
= info
->fattr
;
74 status
= rpc_call_sync(client
, &msg
, 0);
75 dprintk("%s: reply getattr: %d\n", __func__
, status
);
81 * Bare-bones access to getattr: this is for nfs_get_root/nfs_get_sb
84 nfs3_proc_get_root(struct nfs_server
*server
, struct nfs_fh
*fhandle
,
85 struct nfs_fsinfo
*info
)
89 status
= do_proc_get_root(server
->client
, fhandle
, info
);
90 if (status
&& server
->nfs_client
->cl_rpcclient
!= server
->client
)
91 status
= do_proc_get_root(server
->nfs_client
->cl_rpcclient
, fhandle
, info
);
96 * One function for each procedure in the NFS protocol.
99 nfs3_proc_getattr(struct nfs_server
*server
, struct nfs_fh
*fhandle
,
100 struct nfs_fattr
*fattr
)
102 struct rpc_message msg
= {
103 .rpc_proc
= &nfs3_procedures
[NFS3PROC_GETATTR
],
109 dprintk("NFS call getattr\n");
110 nfs_fattr_init(fattr
);
111 status
= rpc_call_sync(server
->client
, &msg
, 0);
112 dprintk("NFS reply getattr: %d\n", status
);
117 nfs3_proc_setattr(struct dentry
*dentry
, struct nfs_fattr
*fattr
,
120 struct inode
*inode
= dentry
->d_inode
;
121 struct nfs3_sattrargs arg
= {
125 struct rpc_message msg
= {
126 .rpc_proc
= &nfs3_procedures
[NFS3PROC_SETATTR
],
132 dprintk("NFS call setattr\n");
133 if (sattr
->ia_valid
& ATTR_FILE
)
134 msg
.rpc_cred
= nfs_file_cred(sattr
->ia_file
);
135 nfs_fattr_init(fattr
);
136 status
= rpc_call_sync(NFS_CLIENT(inode
), &msg
, 0);
138 nfs_setattr_update_inode(inode
, sattr
);
139 dprintk("NFS reply setattr: %d\n", status
);
144 nfs3_proc_lookup(struct inode
*dir
, struct qstr
*name
,
145 struct nfs_fh
*fhandle
, struct nfs_fattr
*fattr
)
147 struct nfs3_diropargs arg
= {
152 struct nfs3_diropres res
= {
156 struct rpc_message msg
= {
157 .rpc_proc
= &nfs3_procedures
[NFS3PROC_LOOKUP
],
163 dprintk("NFS call lookup %s\n", name
->name
);
164 res
.dir_attr
= nfs_alloc_fattr();
165 if (res
.dir_attr
== NULL
)
168 nfs_fattr_init(fattr
);
169 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
170 nfs_refresh_inode(dir
, res
.dir_attr
);
171 if (status
>= 0 && !(fattr
->valid
& NFS_ATTR_FATTR
)) {
172 msg
.rpc_proc
= &nfs3_procedures
[NFS3PROC_GETATTR
];
173 msg
.rpc_argp
= fhandle
;
174 msg
.rpc_resp
= fattr
;
175 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
177 nfs_free_fattr(res
.dir_attr
);
178 dprintk("NFS reply lookup: %d\n", status
);
182 static int nfs3_proc_access(struct inode
*inode
, struct nfs_access_entry
*entry
)
184 struct nfs_fattr fattr
;
185 struct nfs3_accessargs arg
= {
188 struct nfs3_accessres res
= {
191 struct rpc_message msg
= {
192 .rpc_proc
= &nfs3_procedures
[NFS3PROC_ACCESS
],
195 .rpc_cred
= entry
->cred
,
197 int mode
= entry
->mask
;
200 dprintk("NFS call access\n");
203 arg
.access
|= NFS3_ACCESS_READ
;
204 if (S_ISDIR(inode
->i_mode
)) {
205 if (mode
& MAY_WRITE
)
206 arg
.access
|= NFS3_ACCESS_MODIFY
| NFS3_ACCESS_EXTEND
| NFS3_ACCESS_DELETE
;
208 arg
.access
|= NFS3_ACCESS_LOOKUP
;
210 if (mode
& MAY_WRITE
)
211 arg
.access
|= NFS3_ACCESS_MODIFY
| NFS3_ACCESS_EXTEND
;
213 arg
.access
|= NFS3_ACCESS_EXECUTE
;
215 nfs_fattr_init(&fattr
);
216 status
= rpc_call_sync(NFS_CLIENT(inode
), &msg
, 0);
217 nfs_refresh_inode(inode
, &fattr
);
220 if (res
.access
& NFS3_ACCESS_READ
)
221 entry
->mask
|= MAY_READ
;
222 if (res
.access
& (NFS3_ACCESS_MODIFY
| NFS3_ACCESS_EXTEND
| NFS3_ACCESS_DELETE
))
223 entry
->mask
|= MAY_WRITE
;
224 if (res
.access
& (NFS3_ACCESS_LOOKUP
|NFS3_ACCESS_EXECUTE
))
225 entry
->mask
|= MAY_EXEC
;
227 dprintk("NFS reply access: %d\n", status
);
231 static int nfs3_proc_readlink(struct inode
*inode
, struct page
*page
,
232 unsigned int pgbase
, unsigned int pglen
)
234 struct nfs_fattr fattr
;
235 struct nfs3_readlinkargs args
= {
241 struct rpc_message msg
= {
242 .rpc_proc
= &nfs3_procedures
[NFS3PROC_READLINK
],
248 dprintk("NFS call readlink\n");
249 nfs_fattr_init(&fattr
);
250 status
= rpc_call_sync(NFS_CLIENT(inode
), &msg
, 0);
251 nfs_refresh_inode(inode
, &fattr
);
252 dprintk("NFS reply readlink: %d\n", status
);
256 struct nfs3_createdata
{
257 struct rpc_message msg
;
259 struct nfs3_createargs create
;
260 struct nfs3_mkdirargs mkdir
;
261 struct nfs3_symlinkargs symlink
;
262 struct nfs3_mknodargs mknod
;
264 struct nfs3_diropres res
;
266 struct nfs_fattr fattr
;
267 struct nfs_fattr dir_attr
;
270 static struct nfs3_createdata
*nfs3_alloc_createdata(void)
272 struct nfs3_createdata
*data
;
274 data
= kzalloc(sizeof(*data
), GFP_KERNEL
);
276 data
->msg
.rpc_argp
= &data
->arg
;
277 data
->msg
.rpc_resp
= &data
->res
;
278 data
->res
.fh
= &data
->fh
;
279 data
->res
.fattr
= &data
->fattr
;
280 data
->res
.dir_attr
= &data
->dir_attr
;
281 nfs_fattr_init(data
->res
.fattr
);
282 nfs_fattr_init(data
->res
.dir_attr
);
287 static int nfs3_do_create(struct inode
*dir
, struct dentry
*dentry
, struct nfs3_createdata
*data
)
291 status
= rpc_call_sync(NFS_CLIENT(dir
), &data
->msg
, 0);
292 nfs_post_op_update_inode(dir
, data
->res
.dir_attr
);
294 status
= nfs_instantiate(dentry
, data
->res
.fh
, data
->res
.fattr
);
298 static void nfs3_free_createdata(struct nfs3_createdata
*data
)
304 * Create a regular file.
307 nfs3_proc_create(struct inode
*dir
, struct dentry
*dentry
, struct iattr
*sattr
,
308 int flags
, struct nameidata
*nd
)
310 struct nfs3_createdata
*data
;
311 mode_t mode
= sattr
->ia_mode
;
312 int status
= -ENOMEM
;
314 dprintk("NFS call create %s\n", dentry
->d_name
.name
);
316 data
= nfs3_alloc_createdata();
320 data
->msg
.rpc_proc
= &nfs3_procedures
[NFS3PROC_CREATE
];
321 data
->arg
.create
.fh
= NFS_FH(dir
);
322 data
->arg
.create
.name
= dentry
->d_name
.name
;
323 data
->arg
.create
.len
= dentry
->d_name
.len
;
324 data
->arg
.create
.sattr
= sattr
;
326 data
->arg
.create
.createmode
= NFS3_CREATE_UNCHECKED
;
327 if (flags
& O_EXCL
) {
328 data
->arg
.create
.createmode
= NFS3_CREATE_EXCLUSIVE
;
329 data
->arg
.create
.verifier
[0] = jiffies
;
330 data
->arg
.create
.verifier
[1] = current
->pid
;
333 sattr
->ia_mode
&= ~current_umask();
336 status
= nfs3_do_create(dir
, dentry
, data
);
338 if (status
!= -ENOTSUPP
)
340 /* If the server doesn't support the exclusive creation
341 * semantics, try again with simple 'guarded' mode. */
342 switch (data
->arg
.create
.createmode
) {
343 case NFS3_CREATE_EXCLUSIVE
:
344 data
->arg
.create
.createmode
= NFS3_CREATE_GUARDED
;
347 case NFS3_CREATE_GUARDED
:
348 data
->arg
.create
.createmode
= NFS3_CREATE_UNCHECKED
;
351 case NFS3_CREATE_UNCHECKED
:
354 nfs_fattr_init(data
->res
.dir_attr
);
355 nfs_fattr_init(data
->res
.fattr
);
361 /* When we created the file with exclusive semantics, make
362 * sure we set the attributes afterwards. */
363 if (data
->arg
.create
.createmode
== NFS3_CREATE_EXCLUSIVE
) {
364 dprintk("NFS call setattr (post-create)\n");
366 if (!(sattr
->ia_valid
& ATTR_ATIME_SET
))
367 sattr
->ia_valid
|= ATTR_ATIME
;
368 if (!(sattr
->ia_valid
& ATTR_MTIME_SET
))
369 sattr
->ia_valid
|= ATTR_MTIME
;
371 /* Note: we could use a guarded setattr here, but I'm
372 * not sure this buys us anything (and I'd have
373 * to revamp the NFSv3 XDR code) */
374 status
= nfs3_proc_setattr(dentry
, data
->res
.fattr
, sattr
);
375 nfs_post_op_update_inode(dentry
->d_inode
, data
->res
.fattr
);
376 dprintk("NFS reply setattr (post-create): %d\n", status
);
380 status
= nfs3_proc_set_default_acl(dir
, dentry
->d_inode
, mode
);
382 nfs3_free_createdata(data
);
383 dprintk("NFS reply create: %d\n", status
);
388 nfs3_proc_remove(struct inode
*dir
, struct qstr
*name
)
390 struct nfs_removeargs arg
= {
392 .name
.len
= name
->len
,
393 .name
.name
= name
->name
,
395 struct nfs_removeres res
;
396 struct rpc_message msg
= {
397 .rpc_proc
= &nfs3_procedures
[NFS3PROC_REMOVE
],
403 dprintk("NFS call remove %s\n", name
->name
);
404 nfs_fattr_init(&res
.dir_attr
);
405 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
406 nfs_post_op_update_inode(dir
, &res
.dir_attr
);
407 dprintk("NFS reply remove: %d\n", status
);
412 nfs3_proc_unlink_setup(struct rpc_message
*msg
, struct inode
*dir
)
414 msg
->rpc_proc
= &nfs3_procedures
[NFS3PROC_REMOVE
];
418 nfs3_proc_unlink_done(struct rpc_task
*task
, struct inode
*dir
)
420 struct nfs_removeres
*res
;
421 if (nfs3_async_handle_jukebox(task
, dir
))
423 res
= task
->tk_msg
.rpc_resp
;
424 nfs_post_op_update_inode(dir
, &res
->dir_attr
);
429 nfs3_proc_rename(struct inode
*old_dir
, struct qstr
*old_name
,
430 struct inode
*new_dir
, struct qstr
*new_name
)
432 struct nfs_fattr old_dir_attr
, new_dir_attr
;
433 struct nfs3_renameargs arg
= {
434 .fromfh
= NFS_FH(old_dir
),
435 .fromname
= old_name
->name
,
436 .fromlen
= old_name
->len
,
437 .tofh
= NFS_FH(new_dir
),
438 .toname
= new_name
->name
,
439 .tolen
= new_name
->len
441 struct nfs3_renameres res
= {
442 .fromattr
= &old_dir_attr
,
443 .toattr
= &new_dir_attr
445 struct rpc_message msg
= {
446 .rpc_proc
= &nfs3_procedures
[NFS3PROC_RENAME
],
452 dprintk("NFS call rename %s -> %s\n", old_name
->name
, new_name
->name
);
453 nfs_fattr_init(&old_dir_attr
);
454 nfs_fattr_init(&new_dir_attr
);
455 status
= rpc_call_sync(NFS_CLIENT(old_dir
), &msg
, 0);
456 nfs_post_op_update_inode(old_dir
, &old_dir_attr
);
457 nfs_post_op_update_inode(new_dir
, &new_dir_attr
);
458 dprintk("NFS reply rename: %d\n", status
);
463 nfs3_proc_link(struct inode
*inode
, struct inode
*dir
, struct qstr
*name
)
465 struct nfs_fattr dir_attr
, fattr
;
466 struct nfs3_linkargs arg
= {
467 .fromfh
= NFS_FH(inode
),
469 .toname
= name
->name
,
472 struct nfs3_linkres res
= {
473 .dir_attr
= &dir_attr
,
476 struct rpc_message msg
= {
477 .rpc_proc
= &nfs3_procedures
[NFS3PROC_LINK
],
483 dprintk("NFS call link %s\n", name
->name
);
484 nfs_fattr_init(&dir_attr
);
485 nfs_fattr_init(&fattr
);
486 status
= rpc_call_sync(NFS_CLIENT(inode
), &msg
, 0);
487 nfs_post_op_update_inode(dir
, &dir_attr
);
488 nfs_post_op_update_inode(inode
, &fattr
);
489 dprintk("NFS reply link: %d\n", status
);
494 nfs3_proc_symlink(struct inode
*dir
, struct dentry
*dentry
, struct page
*page
,
495 unsigned int len
, struct iattr
*sattr
)
497 struct nfs3_createdata
*data
;
498 int status
= -ENOMEM
;
500 if (len
> NFS3_MAXPATHLEN
)
501 return -ENAMETOOLONG
;
503 dprintk("NFS call symlink %s\n", dentry
->d_name
.name
);
505 data
= nfs3_alloc_createdata();
508 data
->msg
.rpc_proc
= &nfs3_procedures
[NFS3PROC_SYMLINK
];
509 data
->arg
.symlink
.fromfh
= NFS_FH(dir
);
510 data
->arg
.symlink
.fromname
= dentry
->d_name
.name
;
511 data
->arg
.symlink
.fromlen
= dentry
->d_name
.len
;
512 data
->arg
.symlink
.pages
= &page
;
513 data
->arg
.symlink
.pathlen
= len
;
514 data
->arg
.symlink
.sattr
= sattr
;
516 status
= nfs3_do_create(dir
, dentry
, data
);
518 nfs3_free_createdata(data
);
520 dprintk("NFS reply symlink: %d\n", status
);
525 nfs3_proc_mkdir(struct inode
*dir
, struct dentry
*dentry
, struct iattr
*sattr
)
527 struct nfs3_createdata
*data
;
528 int mode
= sattr
->ia_mode
;
529 int status
= -ENOMEM
;
531 dprintk("NFS call mkdir %s\n", dentry
->d_name
.name
);
533 sattr
->ia_mode
&= ~current_umask();
535 data
= nfs3_alloc_createdata();
539 data
->msg
.rpc_proc
= &nfs3_procedures
[NFS3PROC_MKDIR
];
540 data
->arg
.mkdir
.fh
= NFS_FH(dir
);
541 data
->arg
.mkdir
.name
= dentry
->d_name
.name
;
542 data
->arg
.mkdir
.len
= dentry
->d_name
.len
;
543 data
->arg
.mkdir
.sattr
= sattr
;
545 status
= nfs3_do_create(dir
, dentry
, data
);
549 status
= nfs3_proc_set_default_acl(dir
, dentry
->d_inode
, mode
);
551 nfs3_free_createdata(data
);
552 dprintk("NFS reply mkdir: %d\n", status
);
557 nfs3_proc_rmdir(struct inode
*dir
, struct qstr
*name
)
559 struct nfs_fattr dir_attr
;
560 struct nfs3_diropargs arg
= {
565 struct rpc_message msg
= {
566 .rpc_proc
= &nfs3_procedures
[NFS3PROC_RMDIR
],
568 .rpc_resp
= &dir_attr
,
572 dprintk("NFS call rmdir %s\n", name
->name
);
573 nfs_fattr_init(&dir_attr
);
574 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
575 nfs_post_op_update_inode(dir
, &dir_attr
);
576 dprintk("NFS reply rmdir: %d\n", status
);
581 * The READDIR implementation is somewhat hackish - we pass the user buffer
582 * to the encode function, which installs it in the receive iovec.
583 * The decode function itself doesn't perform any decoding, it just makes
584 * sure the reply is syntactically correct.
586 * Also note that this implementation handles both plain readdir and
590 nfs3_proc_readdir(struct dentry
*dentry
, struct rpc_cred
*cred
,
591 u64 cookie
, struct page
*page
, unsigned int count
, int plus
)
593 struct inode
*dir
= dentry
->d_inode
;
594 struct nfs_fattr dir_attr
;
595 __be32
*verf
= NFS_COOKIEVERF(dir
);
596 struct nfs3_readdirargs arg
= {
599 .verf
= {verf
[0], verf
[1]},
604 struct nfs3_readdirres res
= {
605 .dir_attr
= &dir_attr
,
609 struct rpc_message msg
= {
610 .rpc_proc
= &nfs3_procedures
[NFS3PROC_READDIR
],
618 msg
.rpc_proc
= &nfs3_procedures
[NFS3PROC_READDIRPLUS
];
620 dprintk("NFS call readdir%s %d\n",
621 plus
? "plus" : "", (unsigned int) cookie
);
623 nfs_fattr_init(&dir_attr
);
624 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
626 nfs_invalidate_atime(dir
);
628 nfs_refresh_inode(dir
, &dir_attr
);
629 dprintk("NFS reply readdir: %d\n", status
);
634 nfs3_proc_mknod(struct inode
*dir
, struct dentry
*dentry
, struct iattr
*sattr
,
637 struct nfs3_createdata
*data
;
638 mode_t mode
= sattr
->ia_mode
;
639 int status
= -ENOMEM
;
641 dprintk("NFS call mknod %s %u:%u\n", dentry
->d_name
.name
,
642 MAJOR(rdev
), MINOR(rdev
));
644 sattr
->ia_mode
&= ~current_umask();
646 data
= nfs3_alloc_createdata();
650 data
->msg
.rpc_proc
= &nfs3_procedures
[NFS3PROC_MKNOD
];
651 data
->arg
.mknod
.fh
= NFS_FH(dir
);
652 data
->arg
.mknod
.name
= dentry
->d_name
.name
;
653 data
->arg
.mknod
.len
= dentry
->d_name
.len
;
654 data
->arg
.mknod
.sattr
= sattr
;
655 data
->arg
.mknod
.rdev
= rdev
;
657 switch (sattr
->ia_mode
& S_IFMT
) {
659 data
->arg
.mknod
.type
= NF3BLK
;
662 data
->arg
.mknod
.type
= NF3CHR
;
665 data
->arg
.mknod
.type
= NF3FIFO
;
668 data
->arg
.mknod
.type
= NF3SOCK
;
675 status
= nfs3_do_create(dir
, dentry
, data
);
678 status
= nfs3_proc_set_default_acl(dir
, dentry
->d_inode
, mode
);
680 nfs3_free_createdata(data
);
681 dprintk("NFS reply mknod: %d\n", status
);
686 nfs3_proc_statfs(struct nfs_server
*server
, struct nfs_fh
*fhandle
,
687 struct nfs_fsstat
*stat
)
689 struct rpc_message msg
= {
690 .rpc_proc
= &nfs3_procedures
[NFS3PROC_FSSTAT
],
696 dprintk("NFS call fsstat\n");
697 nfs_fattr_init(stat
->fattr
);
698 status
= rpc_call_sync(server
->client
, &msg
, 0);
699 dprintk("NFS reply statfs: %d\n", status
);
704 do_proc_fsinfo(struct rpc_clnt
*client
, struct nfs_fh
*fhandle
,
705 struct nfs_fsinfo
*info
)
707 struct rpc_message msg
= {
708 .rpc_proc
= &nfs3_procedures
[NFS3PROC_FSINFO
],
714 dprintk("NFS call fsinfo\n");
715 nfs_fattr_init(info
->fattr
);
716 status
= rpc_call_sync(client
, &msg
, 0);
717 dprintk("NFS reply fsinfo: %d\n", status
);
722 * Bare-bones access to fsinfo: this is for nfs_get_root/nfs_get_sb via
726 nfs3_proc_fsinfo(struct nfs_server
*server
, struct nfs_fh
*fhandle
,
727 struct nfs_fsinfo
*info
)
731 status
= do_proc_fsinfo(server
->client
, fhandle
, info
);
732 if (status
&& server
->nfs_client
->cl_rpcclient
!= server
->client
)
733 status
= do_proc_fsinfo(server
->nfs_client
->cl_rpcclient
, fhandle
, info
);
738 nfs3_proc_pathconf(struct nfs_server
*server
, struct nfs_fh
*fhandle
,
739 struct nfs_pathconf
*info
)
741 struct rpc_message msg
= {
742 .rpc_proc
= &nfs3_procedures
[NFS3PROC_PATHCONF
],
748 dprintk("NFS call pathconf\n");
749 nfs_fattr_init(info
->fattr
);
750 status
= rpc_call_sync(server
->client
, &msg
, 0);
751 dprintk("NFS reply pathconf: %d\n", status
);
755 static int nfs3_read_done(struct rpc_task
*task
, struct nfs_read_data
*data
)
757 if (nfs3_async_handle_jukebox(task
, data
->inode
))
760 nfs_invalidate_atime(data
->inode
);
761 nfs_refresh_inode(data
->inode
, &data
->fattr
);
765 static void nfs3_proc_read_setup(struct nfs_read_data
*data
, struct rpc_message
*msg
)
767 msg
->rpc_proc
= &nfs3_procedures
[NFS3PROC_READ
];
770 static int nfs3_write_done(struct rpc_task
*task
, struct nfs_write_data
*data
)
772 if (nfs3_async_handle_jukebox(task
, data
->inode
))
774 if (task
->tk_status
>= 0)
775 nfs_post_op_update_inode_force_wcc(data
->inode
, data
->res
.fattr
);
779 static void nfs3_proc_write_setup(struct nfs_write_data
*data
, struct rpc_message
*msg
)
781 msg
->rpc_proc
= &nfs3_procedures
[NFS3PROC_WRITE
];
784 static int nfs3_commit_done(struct rpc_task
*task
, struct nfs_write_data
*data
)
786 if (nfs3_async_handle_jukebox(task
, data
->inode
))
788 nfs_refresh_inode(data
->inode
, data
->res
.fattr
);
792 static void nfs3_proc_commit_setup(struct nfs_write_data
*data
, struct rpc_message
*msg
)
794 msg
->rpc_proc
= &nfs3_procedures
[NFS3PROC_COMMIT
];
798 nfs3_proc_lock(struct file
*filp
, int cmd
, struct file_lock
*fl
)
800 struct inode
*inode
= filp
->f_path
.dentry
->d_inode
;
802 return nlmclnt_proc(NFS_SERVER(inode
)->nlm_host
, cmd
, fl
);
805 const struct nfs_rpc_ops nfs_v3_clientops
= {
806 .version
= 3, /* protocol version */
807 .dentry_ops
= &nfs_dentry_operations
,
808 .dir_inode_ops
= &nfs3_dir_inode_operations
,
809 .file_inode_ops
= &nfs3_file_inode_operations
,
810 .getroot
= nfs3_proc_get_root
,
811 .getattr
= nfs3_proc_getattr
,
812 .setattr
= nfs3_proc_setattr
,
813 .lookup
= nfs3_proc_lookup
,
814 .access
= nfs3_proc_access
,
815 .readlink
= nfs3_proc_readlink
,
816 .create
= nfs3_proc_create
,
817 .remove
= nfs3_proc_remove
,
818 .unlink_setup
= nfs3_proc_unlink_setup
,
819 .unlink_done
= nfs3_proc_unlink_done
,
820 .rename
= nfs3_proc_rename
,
821 .link
= nfs3_proc_link
,
822 .symlink
= nfs3_proc_symlink
,
823 .mkdir
= nfs3_proc_mkdir
,
824 .rmdir
= nfs3_proc_rmdir
,
825 .readdir
= nfs3_proc_readdir
,
826 .mknod
= nfs3_proc_mknod
,
827 .statfs
= nfs3_proc_statfs
,
828 .fsinfo
= nfs3_proc_fsinfo
,
829 .pathconf
= nfs3_proc_pathconf
,
830 .decode_dirent
= nfs3_decode_dirent
,
831 .read_setup
= nfs3_proc_read_setup
,
832 .read_done
= nfs3_read_done
,
833 .write_setup
= nfs3_proc_write_setup
,
834 .write_done
= nfs3_write_done
,
835 .commit_setup
= nfs3_proc_commit_setup
,
836 .commit_done
= nfs3_commit_done
,
837 .lock
= nfs3_proc_lock
,
838 .clear_acl_cache
= nfs3_forget_cached_acls
,
839 .close_context
= nfs_close_context
,