2 * linux/fs/nfs/nfs3proc.c
4 * Client-side NFSv3 procedures stubs.
6 * Copyright (C) 1997, Olaf Kirch
10 #include <linux/utsname.h>
11 #include <linux/errno.h>
12 #include <linux/string.h>
13 #include <linux/sunrpc/clnt.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 error message */
28 nfs3_rpc_wrapper(struct rpc_clnt
*clnt
, struct rpc_message
*msg
, int flags
)
32 rpc_clnt_sigmask(clnt
, &oldset
);
34 res
= rpc_call_sync(clnt
, msg
, flags
);
37 schedule_timeout_interruptible(NFS_JUKEBOX_RETRY_TIME
);
39 } while (!signalled());
40 rpc_clnt_sigunmask(clnt
, &oldset
);
44 #define rpc_call_sync(clnt, msg, flags) nfs3_rpc_wrapper(clnt, msg, flags)
47 nfs3_async_handle_jukebox(struct rpc_task
*task
, struct inode
*inode
)
49 if (task
->tk_status
!= -EJUKEBOX
)
51 nfs_inc_stats(inode
, NFSIOS_DELAY
);
53 rpc_restart_call(task
);
54 rpc_delay(task
, NFS_JUKEBOX_RETRY_TIME
);
59 do_proc_get_root(struct rpc_clnt
*client
, struct nfs_fh
*fhandle
,
60 struct nfs_fsinfo
*info
)
62 struct rpc_message msg
= {
63 .rpc_proc
= &nfs3_procedures
[NFS3PROC_FSINFO
],
69 dprintk("%s: call fsinfo\n", __FUNCTION__
);
70 nfs_fattr_init(info
->fattr
);
71 status
= rpc_call_sync(client
, &msg
, 0);
72 dprintk("%s: reply fsinfo: %d\n", __FUNCTION__
, status
);
73 if (!(info
->fattr
->valid
& NFS_ATTR_FATTR
)) {
74 msg
.rpc_proc
= &nfs3_procedures
[NFS3PROC_GETATTR
];
75 msg
.rpc_resp
= info
->fattr
;
76 status
= rpc_call_sync(client
, &msg
, 0);
77 dprintk("%s: reply getattr: %d\n", __FUNCTION__
, status
);
83 * Bare-bones access to getattr: this is for nfs_get_root/nfs_get_sb
86 nfs3_proc_get_root(struct nfs_server
*server
, struct nfs_fh
*fhandle
,
87 struct nfs_fsinfo
*info
)
91 status
= do_proc_get_root(server
->client
, fhandle
, info
);
92 if (status
&& server
->nfs_client
->cl_rpcclient
!= server
->client
)
93 status
= do_proc_get_root(server
->nfs_client
->cl_rpcclient
, fhandle
, info
);
98 * One function for each procedure in the NFS protocol.
101 nfs3_proc_getattr(struct nfs_server
*server
, struct nfs_fh
*fhandle
,
102 struct nfs_fattr
*fattr
)
104 struct rpc_message msg
= {
105 .rpc_proc
= &nfs3_procedures
[NFS3PROC_GETATTR
],
111 dprintk("NFS call getattr\n");
112 nfs_fattr_init(fattr
);
113 status
= rpc_call_sync(server
->client
, &msg
, 0);
114 dprintk("NFS reply getattr: %d\n", status
);
119 nfs3_proc_setattr(struct dentry
*dentry
, struct nfs_fattr
*fattr
,
122 struct inode
*inode
= dentry
->d_inode
;
123 struct nfs3_sattrargs arg
= {
127 struct rpc_message msg
= {
128 .rpc_proc
= &nfs3_procedures
[NFS3PROC_SETATTR
],
134 dprintk("NFS call setattr\n");
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 nfs_fattr dir_attr
;
148 struct nfs3_diropargs arg
= {
153 struct nfs3_diropres res
= {
154 .dir_attr
= &dir_attr
,
158 struct rpc_message msg
= {
159 .rpc_proc
= &nfs3_procedures
[NFS3PROC_LOOKUP
],
165 dprintk("NFS call lookup %s\n", name
->name
);
166 nfs_fattr_init(&dir_attr
);
167 nfs_fattr_init(fattr
);
168 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
169 if (status
>= 0 && !(fattr
->valid
& NFS_ATTR_FATTR
)) {
170 msg
.rpc_proc
= &nfs3_procedures
[NFS3PROC_GETATTR
];
171 msg
.rpc_argp
= fhandle
;
172 msg
.rpc_resp
= fattr
;
173 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
175 dprintk("NFS reply lookup: %d\n", status
);
177 status
= nfs_refresh_inode(dir
, &dir_attr
);
181 static int nfs3_proc_access(struct inode
*inode
, struct nfs_access_entry
*entry
)
183 struct nfs_fattr fattr
;
184 struct nfs3_accessargs arg
= {
187 struct nfs3_accessres res
= {
190 struct rpc_message msg
= {
191 .rpc_proc
= &nfs3_procedures
[NFS3PROC_ACCESS
],
194 .rpc_cred
= entry
->cred
,
196 int mode
= entry
->mask
;
199 dprintk("NFS call access\n");
202 arg
.access
|= NFS3_ACCESS_READ
;
203 if (S_ISDIR(inode
->i_mode
)) {
204 if (mode
& MAY_WRITE
)
205 arg
.access
|= NFS3_ACCESS_MODIFY
| NFS3_ACCESS_EXTEND
| NFS3_ACCESS_DELETE
;
207 arg
.access
|= NFS3_ACCESS_LOOKUP
;
209 if (mode
& MAY_WRITE
)
210 arg
.access
|= NFS3_ACCESS_MODIFY
| NFS3_ACCESS_EXTEND
;
212 arg
.access
|= NFS3_ACCESS_EXECUTE
;
214 nfs_fattr_init(&fattr
);
215 status
= rpc_call_sync(NFS_CLIENT(inode
), &msg
, 0);
216 nfs_refresh_inode(inode
, &fattr
);
219 if (res
.access
& NFS3_ACCESS_READ
)
220 entry
->mask
|= MAY_READ
;
221 if (res
.access
& (NFS3_ACCESS_MODIFY
| NFS3_ACCESS_EXTEND
| NFS3_ACCESS_DELETE
))
222 entry
->mask
|= MAY_WRITE
;
223 if (res
.access
& (NFS3_ACCESS_LOOKUP
|NFS3_ACCESS_EXECUTE
))
224 entry
->mask
|= MAY_EXEC
;
226 dprintk("NFS reply access: %d\n", status
);
230 static int nfs3_proc_readlink(struct inode
*inode
, struct page
*page
,
231 unsigned int pgbase
, unsigned int pglen
)
233 struct nfs_fattr fattr
;
234 struct nfs3_readlinkargs args
= {
240 struct rpc_message msg
= {
241 .rpc_proc
= &nfs3_procedures
[NFS3PROC_READLINK
],
247 dprintk("NFS call readlink\n");
248 nfs_fattr_init(&fattr
);
249 status
= rpc_call_sync(NFS_CLIENT(inode
), &msg
, 0);
250 nfs_refresh_inode(inode
, &fattr
);
251 dprintk("NFS reply readlink: %d\n", status
);
256 * Create a regular file.
257 * For now, we don't implement O_EXCL.
260 nfs3_proc_create(struct inode
*dir
, struct dentry
*dentry
, struct iattr
*sattr
,
261 int flags
, struct nameidata
*nd
)
263 struct nfs_fh fhandle
;
264 struct nfs_fattr fattr
;
265 struct nfs_fattr dir_attr
;
266 struct nfs3_createargs arg
= {
268 .name
= dentry
->d_name
.name
,
269 .len
= dentry
->d_name
.len
,
272 struct nfs3_diropres res
= {
273 .dir_attr
= &dir_attr
,
277 struct rpc_message msg
= {
278 .rpc_proc
= &nfs3_procedures
[NFS3PROC_CREATE
],
282 mode_t mode
= sattr
->ia_mode
;
285 dprintk("NFS call create %s\n", dentry
->d_name
.name
);
286 arg
.createmode
= NFS3_CREATE_UNCHECKED
;
287 if (flags
& O_EXCL
) {
288 arg
.createmode
= NFS3_CREATE_EXCLUSIVE
;
289 arg
.verifier
[0] = jiffies
;
290 arg
.verifier
[1] = current
->pid
;
293 sattr
->ia_mode
&= ~current
->fs
->umask
;
296 nfs_fattr_init(&dir_attr
);
297 nfs_fattr_init(&fattr
);
298 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
299 nfs_refresh_inode(dir
, &dir_attr
);
301 /* If the server doesn't support the exclusive creation semantics,
302 * try again with simple 'guarded' mode. */
303 if (status
== -ENOTSUPP
) {
304 switch (arg
.createmode
) {
305 case NFS3_CREATE_EXCLUSIVE
:
306 arg
.createmode
= NFS3_CREATE_GUARDED
;
309 case NFS3_CREATE_GUARDED
:
310 arg
.createmode
= NFS3_CREATE_UNCHECKED
;
313 case NFS3_CREATE_UNCHECKED
:
320 status
= nfs_instantiate(dentry
, &fhandle
, &fattr
);
324 /* When we created the file with exclusive semantics, make
325 * sure we set the attributes afterwards. */
326 if (arg
.createmode
== NFS3_CREATE_EXCLUSIVE
) {
327 dprintk("NFS call setattr (post-create)\n");
329 if (!(sattr
->ia_valid
& ATTR_ATIME_SET
))
330 sattr
->ia_valid
|= ATTR_ATIME
;
331 if (!(sattr
->ia_valid
& ATTR_MTIME_SET
))
332 sattr
->ia_valid
|= ATTR_MTIME
;
334 /* Note: we could use a guarded setattr here, but I'm
335 * not sure this buys us anything (and I'd have
336 * to revamp the NFSv3 XDR code) */
337 status
= nfs3_proc_setattr(dentry
, &fattr
, sattr
);
338 nfs_post_op_update_inode(dentry
->d_inode
, &fattr
);
339 dprintk("NFS reply setattr (post-create): %d\n", status
);
343 status
= nfs3_proc_set_default_acl(dir
, dentry
->d_inode
, mode
);
345 dprintk("NFS reply create: %d\n", status
);
350 nfs3_proc_remove(struct inode
*dir
, struct qstr
*name
)
352 struct nfs_fattr dir_attr
;
353 struct nfs3_diropargs arg
= {
358 struct rpc_message msg
= {
359 .rpc_proc
= &nfs3_procedures
[NFS3PROC_REMOVE
],
361 .rpc_resp
= &dir_attr
,
365 dprintk("NFS call remove %s\n", name
->name
);
366 nfs_fattr_init(&dir_attr
);
367 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
368 nfs_post_op_update_inode(dir
, &dir_attr
);
369 dprintk("NFS reply remove: %d\n", status
);
374 nfs3_proc_unlink_setup(struct rpc_message
*msg
, struct dentry
*dir
, struct qstr
*name
)
377 struct nfs3_diropargs arg
;
378 struct nfs_fattr res
;
381 ptr
= kmalloc(sizeof(*ptr
), GFP_KERNEL
);
384 ptr
->arg
.fh
= NFS_FH(dir
->d_inode
);
385 ptr
->arg
.name
= name
->name
;
386 ptr
->arg
.len
= name
->len
;
387 nfs_fattr_init(&ptr
->res
);
388 msg
->rpc_proc
= &nfs3_procedures
[NFS3PROC_REMOVE
];
389 msg
->rpc_argp
= &ptr
->arg
;
390 msg
->rpc_resp
= &ptr
->res
;
395 nfs3_proc_unlink_done(struct dentry
*dir
, struct rpc_task
*task
)
397 struct rpc_message
*msg
= &task
->tk_msg
;
398 struct nfs_fattr
*dir_attr
;
400 if (nfs3_async_handle_jukebox(task
, dir
->d_inode
))
403 dir_attr
= (struct nfs_fattr
*)msg
->rpc_resp
;
404 nfs_post_op_update_inode(dir
->d_inode
, dir_attr
);
405 kfree(msg
->rpc_argp
);
411 nfs3_proc_rename(struct inode
*old_dir
, struct qstr
*old_name
,
412 struct inode
*new_dir
, struct qstr
*new_name
)
414 struct nfs_fattr old_dir_attr
, new_dir_attr
;
415 struct nfs3_renameargs arg
= {
416 .fromfh
= NFS_FH(old_dir
),
417 .fromname
= old_name
->name
,
418 .fromlen
= old_name
->len
,
419 .tofh
= NFS_FH(new_dir
),
420 .toname
= new_name
->name
,
421 .tolen
= new_name
->len
423 struct nfs3_renameres res
= {
424 .fromattr
= &old_dir_attr
,
425 .toattr
= &new_dir_attr
427 struct rpc_message msg
= {
428 .rpc_proc
= &nfs3_procedures
[NFS3PROC_RENAME
],
434 dprintk("NFS call rename %s -> %s\n", old_name
->name
, new_name
->name
);
435 nfs_fattr_init(&old_dir_attr
);
436 nfs_fattr_init(&new_dir_attr
);
437 status
= rpc_call_sync(NFS_CLIENT(old_dir
), &msg
, 0);
438 nfs_post_op_update_inode(old_dir
, &old_dir_attr
);
439 nfs_post_op_update_inode(new_dir
, &new_dir_attr
);
440 dprintk("NFS reply rename: %d\n", status
);
445 nfs3_proc_link(struct inode
*inode
, struct inode
*dir
, struct qstr
*name
)
447 struct nfs_fattr dir_attr
, fattr
;
448 struct nfs3_linkargs arg
= {
449 .fromfh
= NFS_FH(inode
),
451 .toname
= name
->name
,
454 struct nfs3_linkres res
= {
455 .dir_attr
= &dir_attr
,
458 struct rpc_message msg
= {
459 .rpc_proc
= &nfs3_procedures
[NFS3PROC_LINK
],
465 dprintk("NFS call link %s\n", name
->name
);
466 nfs_fattr_init(&dir_attr
);
467 nfs_fattr_init(&fattr
);
468 status
= rpc_call_sync(NFS_CLIENT(inode
), &msg
, 0);
469 nfs_post_op_update_inode(dir
, &dir_attr
);
470 nfs_post_op_update_inode(inode
, &fattr
);
471 dprintk("NFS reply link: %d\n", status
);
476 nfs3_proc_symlink(struct inode
*dir
, struct dentry
*dentry
, struct page
*page
,
477 unsigned int len
, struct iattr
*sattr
)
479 struct nfs_fh fhandle
;
480 struct nfs_fattr fattr
, dir_attr
;
481 struct nfs3_symlinkargs arg
= {
482 .fromfh
= NFS_FH(dir
),
483 .fromname
= dentry
->d_name
.name
,
484 .fromlen
= dentry
->d_name
.len
,
489 struct nfs3_diropres res
= {
490 .dir_attr
= &dir_attr
,
494 struct rpc_message msg
= {
495 .rpc_proc
= &nfs3_procedures
[NFS3PROC_SYMLINK
],
501 if (len
> NFS3_MAXPATHLEN
)
502 return -ENAMETOOLONG
;
504 dprintk("NFS call symlink %s\n", dentry
->d_name
.name
);
506 nfs_fattr_init(&dir_attr
);
507 nfs_fattr_init(&fattr
);
508 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
509 nfs_post_op_update_inode(dir
, &dir_attr
);
512 status
= nfs_instantiate(dentry
, &fhandle
, &fattr
);
514 dprintk("NFS reply symlink: %d\n", status
);
519 nfs3_proc_mkdir(struct inode
*dir
, struct dentry
*dentry
, struct iattr
*sattr
)
521 struct nfs_fh fhandle
;
522 struct nfs_fattr fattr
, dir_attr
;
523 struct nfs3_mkdirargs arg
= {
525 .name
= dentry
->d_name
.name
,
526 .len
= dentry
->d_name
.len
,
529 struct nfs3_diropres res
= {
530 .dir_attr
= &dir_attr
,
534 struct rpc_message msg
= {
535 .rpc_proc
= &nfs3_procedures
[NFS3PROC_MKDIR
],
539 int mode
= sattr
->ia_mode
;
542 dprintk("NFS call mkdir %s\n", dentry
->d_name
.name
);
544 sattr
->ia_mode
&= ~current
->fs
->umask
;
546 nfs_fattr_init(&dir_attr
);
547 nfs_fattr_init(&fattr
);
548 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
549 nfs_post_op_update_inode(dir
, &dir_attr
);
552 status
= nfs_instantiate(dentry
, &fhandle
, &fattr
);
555 status
= nfs3_proc_set_default_acl(dir
, dentry
->d_inode
, mode
);
557 dprintk("NFS reply mkdir: %d\n", status
);
562 nfs3_proc_rmdir(struct inode
*dir
, struct qstr
*name
)
564 struct nfs_fattr dir_attr
;
565 struct nfs3_diropargs arg
= {
570 struct rpc_message msg
= {
571 .rpc_proc
= &nfs3_procedures
[NFS3PROC_RMDIR
],
573 .rpc_resp
= &dir_attr
,
577 dprintk("NFS call rmdir %s\n", name
->name
);
578 nfs_fattr_init(&dir_attr
);
579 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
580 nfs_post_op_update_inode(dir
, &dir_attr
);
581 dprintk("NFS reply rmdir: %d\n", status
);
586 * The READDIR implementation is somewhat hackish - we pass the user buffer
587 * to the encode function, which installs it in the receive iovec.
588 * The decode function itself doesn't perform any decoding, it just makes
589 * sure the reply is syntactically correct.
591 * Also note that this implementation handles both plain readdir and
595 nfs3_proc_readdir(struct dentry
*dentry
, struct rpc_cred
*cred
,
596 u64 cookie
, struct page
*page
, unsigned int count
, int plus
)
598 struct inode
*dir
= dentry
->d_inode
;
599 struct nfs_fattr dir_attr
;
600 __be32
*verf
= NFS_COOKIEVERF(dir
);
601 struct nfs3_readdirargs arg
= {
604 .verf
= {verf
[0], verf
[1]},
609 struct nfs3_readdirres res
= {
610 .dir_attr
= &dir_attr
,
614 struct rpc_message msg
= {
615 .rpc_proc
= &nfs3_procedures
[NFS3PROC_READDIR
],
623 msg
.rpc_proc
= &nfs3_procedures
[NFS3PROC_READDIRPLUS
];
625 dprintk("NFS call readdir%s %d\n",
626 plus
? "plus" : "", (unsigned int) cookie
);
628 nfs_fattr_init(&dir_attr
);
629 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
630 nfs_refresh_inode(dir
, &dir_attr
);
631 dprintk("NFS reply readdir: %d\n", status
);
636 nfs3_proc_mknod(struct inode
*dir
, struct dentry
*dentry
, struct iattr
*sattr
,
640 struct nfs_fattr fattr
, dir_attr
;
641 struct nfs3_mknodargs arg
= {
643 .name
= dentry
->d_name
.name
,
644 .len
= dentry
->d_name
.len
,
648 struct nfs3_diropres res
= {
649 .dir_attr
= &dir_attr
,
653 struct rpc_message msg
= {
654 .rpc_proc
= &nfs3_procedures
[NFS3PROC_MKNOD
],
658 mode_t mode
= sattr
->ia_mode
;
661 switch (sattr
->ia_mode
& S_IFMT
) {
662 case S_IFBLK
: arg
.type
= NF3BLK
; break;
663 case S_IFCHR
: arg
.type
= NF3CHR
; break;
664 case S_IFIFO
: arg
.type
= NF3FIFO
; break;
665 case S_IFSOCK
: arg
.type
= NF3SOCK
; break;
666 default: return -EINVAL
;
669 dprintk("NFS call mknod %s %u:%u\n", dentry
->d_name
.name
,
670 MAJOR(rdev
), MINOR(rdev
));
672 sattr
->ia_mode
&= ~current
->fs
->umask
;
674 nfs_fattr_init(&dir_attr
);
675 nfs_fattr_init(&fattr
);
676 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
677 nfs_post_op_update_inode(dir
, &dir_attr
);
680 status
= nfs_instantiate(dentry
, &fh
, &fattr
);
683 status
= nfs3_proc_set_default_acl(dir
, dentry
->d_inode
, mode
);
685 dprintk("NFS reply mknod: %d\n", status
);
690 nfs3_proc_statfs(struct nfs_server
*server
, struct nfs_fh
*fhandle
,
691 struct nfs_fsstat
*stat
)
693 struct rpc_message msg
= {
694 .rpc_proc
= &nfs3_procedures
[NFS3PROC_FSSTAT
],
700 dprintk("NFS call fsstat\n");
701 nfs_fattr_init(stat
->fattr
);
702 status
= rpc_call_sync(server
->client
, &msg
, 0);
703 dprintk("NFS reply statfs: %d\n", status
);
708 nfs3_proc_fsinfo(struct nfs_server
*server
, struct nfs_fh
*fhandle
,
709 struct nfs_fsinfo
*info
)
711 struct rpc_message msg
= {
712 .rpc_proc
= &nfs3_procedures
[NFS3PROC_FSINFO
],
718 dprintk("NFS call fsinfo\n");
719 nfs_fattr_init(info
->fattr
);
720 status
= rpc_call_sync(server
->nfs_client
->cl_rpcclient
, &msg
, 0);
721 dprintk("NFS reply fsinfo: %d\n", status
);
726 nfs3_proc_pathconf(struct nfs_server
*server
, struct nfs_fh
*fhandle
,
727 struct nfs_pathconf
*info
)
729 struct rpc_message msg
= {
730 .rpc_proc
= &nfs3_procedures
[NFS3PROC_PATHCONF
],
736 dprintk("NFS call pathconf\n");
737 nfs_fattr_init(info
->fattr
);
738 status
= rpc_call_sync(server
->client
, &msg
, 0);
739 dprintk("NFS reply pathconf: %d\n", status
);
743 static int nfs3_read_done(struct rpc_task
*task
, struct nfs_read_data
*data
)
745 if (nfs3_async_handle_jukebox(task
, data
->inode
))
747 /* Call back common NFS readpage processing */
748 if (task
->tk_status
>= 0)
749 nfs_refresh_inode(data
->inode
, &data
->fattr
);
753 static void nfs3_proc_read_setup(struct nfs_read_data
*data
)
755 struct rpc_message msg
= {
756 .rpc_proc
= &nfs3_procedures
[NFS3PROC_READ
],
757 .rpc_argp
= &data
->args
,
758 .rpc_resp
= &data
->res
,
759 .rpc_cred
= data
->cred
,
762 rpc_call_setup(&data
->task
, &msg
, 0);
765 static int nfs3_write_done(struct rpc_task
*task
, struct nfs_write_data
*data
)
767 if (nfs3_async_handle_jukebox(task
, data
->inode
))
769 if (task
->tk_status
>= 0)
770 nfs_post_op_update_inode(data
->inode
, data
->res
.fattr
);
774 static void nfs3_proc_write_setup(struct nfs_write_data
*data
, int how
)
776 struct rpc_message msg
= {
777 .rpc_proc
= &nfs3_procedures
[NFS3PROC_WRITE
],
778 .rpc_argp
= &data
->args
,
779 .rpc_resp
= &data
->res
,
780 .rpc_cred
= data
->cred
,
783 data
->args
.stable
= NFS_UNSTABLE
;
784 if (how
& FLUSH_STABLE
) {
785 data
->args
.stable
= NFS_FILE_SYNC
;
786 if (NFS_I(data
->inode
)->ncommit
)
787 data
->args
.stable
= NFS_DATA_SYNC
;
790 /* Finalize the task. */
791 rpc_call_setup(&data
->task
, &msg
, 0);
794 static int nfs3_commit_done(struct rpc_task
*task
, struct nfs_write_data
*data
)
796 if (nfs3_async_handle_jukebox(task
, data
->inode
))
798 if (task
->tk_status
>= 0)
799 nfs_post_op_update_inode(data
->inode
, data
->res
.fattr
);
803 static void nfs3_proc_commit_setup(struct nfs_write_data
*data
, int how
)
805 struct rpc_message msg
= {
806 .rpc_proc
= &nfs3_procedures
[NFS3PROC_COMMIT
],
807 .rpc_argp
= &data
->args
,
808 .rpc_resp
= &data
->res
,
809 .rpc_cred
= data
->cred
,
812 rpc_call_setup(&data
->task
, &msg
, 0);
816 nfs3_proc_lock(struct file
*filp
, int cmd
, struct file_lock
*fl
)
818 return nlmclnt_proc(filp
->f_path
.dentry
->d_inode
, cmd
, fl
);
821 const struct nfs_rpc_ops nfs_v3_clientops
= {
822 .version
= 3, /* protocol version */
823 .dentry_ops
= &nfs_dentry_operations
,
824 .dir_inode_ops
= &nfs3_dir_inode_operations
,
825 .file_inode_ops
= &nfs3_file_inode_operations
,
826 .getroot
= nfs3_proc_get_root
,
827 .getattr
= nfs3_proc_getattr
,
828 .setattr
= nfs3_proc_setattr
,
829 .lookup
= nfs3_proc_lookup
,
830 .access
= nfs3_proc_access
,
831 .readlink
= nfs3_proc_readlink
,
832 .create
= nfs3_proc_create
,
833 .remove
= nfs3_proc_remove
,
834 .unlink_setup
= nfs3_proc_unlink_setup
,
835 .unlink_done
= nfs3_proc_unlink_done
,
836 .rename
= nfs3_proc_rename
,
837 .link
= nfs3_proc_link
,
838 .symlink
= nfs3_proc_symlink
,
839 .mkdir
= nfs3_proc_mkdir
,
840 .rmdir
= nfs3_proc_rmdir
,
841 .readdir
= nfs3_proc_readdir
,
842 .mknod
= nfs3_proc_mknod
,
843 .statfs
= nfs3_proc_statfs
,
844 .fsinfo
= nfs3_proc_fsinfo
,
845 .pathconf
= nfs3_proc_pathconf
,
846 .decode_dirent
= nfs3_decode_dirent
,
847 .read_setup
= nfs3_proc_read_setup
,
848 .read_done
= nfs3_read_done
,
849 .write_setup
= nfs3_proc_write_setup
,
850 .write_done
= nfs3_write_done
,
851 .commit_setup
= nfs3_proc_commit_setup
,
852 .commit_done
= nfs3_commit_done
,
853 .file_open
= nfs_open
,
854 .file_release
= nfs_release
,
855 .lock
= nfs3_proc_lock
,
856 .clear_acl_cache
= nfs3_forget_cached_acls
,