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/smp_lock.h>
20 #include <linux/nfs_mount.h>
25 #define NFSDBG_FACILITY NFSDBG_PROC
27 /* A wrapper to handle the EJUKEBOX error message */
29 nfs3_rpc_wrapper(struct rpc_clnt
*clnt
, struct rpc_message
*msg
, int flags
)
33 rpc_clnt_sigmask(clnt
, &oldset
);
35 res
= rpc_call_sync(clnt
, msg
, flags
);
38 schedule_timeout_interruptible(NFS_JUKEBOX_RETRY_TIME
);
40 } while (!signalled());
41 rpc_clnt_sigunmask(clnt
, &oldset
);
45 #define rpc_call_sync(clnt, msg, flags) nfs3_rpc_wrapper(clnt, msg, flags)
48 nfs3_async_handle_jukebox(struct rpc_task
*task
, struct inode
*inode
)
50 if (task
->tk_status
!= -EJUKEBOX
)
52 nfs_inc_stats(inode
, NFSIOS_DELAY
);
54 rpc_restart_call(task
);
55 rpc_delay(task
, NFS_JUKEBOX_RETRY_TIME
);
60 do_proc_get_root(struct rpc_clnt
*client
, struct nfs_fh
*fhandle
,
61 struct nfs_fsinfo
*info
)
63 struct rpc_message msg
= {
64 .rpc_proc
= &nfs3_procedures
[NFS3PROC_FSINFO
],
70 dprintk("%s: call fsinfo\n", __FUNCTION__
);
71 nfs_fattr_init(info
->fattr
);
72 status
= rpc_call_sync(client
, &msg
, 0);
73 dprintk("%s: reply fsinfo: %d\n", __FUNCTION__
, status
);
74 if (!(info
->fattr
->valid
& NFS_ATTR_FATTR
)) {
75 msg
.rpc_proc
= &nfs3_procedures
[NFS3PROC_GETATTR
];
76 msg
.rpc_resp
= info
->fattr
;
77 status
= rpc_call_sync(client
, &msg
, 0);
78 dprintk("%s: reply getattr: %d\n", __FUNCTION__
, status
);
84 * Bare-bones access to getattr: this is for nfs_get_root/nfs_get_sb
87 nfs3_proc_get_root(struct nfs_server
*server
, struct nfs_fh
*fhandle
,
88 struct nfs_fsinfo
*info
)
92 status
= do_proc_get_root(server
->client
, fhandle
, info
);
93 if (status
&& server
->nfs_client
->cl_rpcclient
!= server
->client
)
94 status
= do_proc_get_root(server
->nfs_client
->cl_rpcclient
, fhandle
, info
);
99 * One function for each procedure in the NFS protocol.
102 nfs3_proc_getattr(struct nfs_server
*server
, struct nfs_fh
*fhandle
,
103 struct nfs_fattr
*fattr
)
105 struct rpc_message msg
= {
106 .rpc_proc
= &nfs3_procedures
[NFS3PROC_GETATTR
],
112 dprintk("NFS call getattr\n");
113 nfs_fattr_init(fattr
);
114 status
= rpc_call_sync(server
->client
, &msg
, 0);
115 dprintk("NFS reply getattr: %d\n", status
);
120 nfs3_proc_setattr(struct dentry
*dentry
, struct nfs_fattr
*fattr
,
123 struct inode
*inode
= dentry
->d_inode
;
124 struct nfs3_sattrargs arg
= {
128 struct rpc_message msg
= {
129 .rpc_proc
= &nfs3_procedures
[NFS3PROC_SETATTR
],
135 dprintk("NFS call setattr\n");
136 nfs_fattr_init(fattr
);
137 status
= rpc_call_sync(NFS_CLIENT(inode
), &msg
, 0);
139 nfs_setattr_update_inode(inode
, sattr
);
140 dprintk("NFS reply setattr: %d\n", status
);
145 nfs3_proc_lookup(struct inode
*dir
, struct qstr
*name
,
146 struct nfs_fh
*fhandle
, struct nfs_fattr
*fattr
)
148 struct nfs_fattr dir_attr
;
149 struct nfs3_diropargs arg
= {
154 struct nfs3_diropres res
= {
155 .dir_attr
= &dir_attr
,
159 struct rpc_message msg
= {
160 .rpc_proc
= &nfs3_procedures
[NFS3PROC_LOOKUP
],
166 dprintk("NFS call lookup %s\n", name
->name
);
167 nfs_fattr_init(&dir_attr
);
168 nfs_fattr_init(fattr
);
169 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
170 if (status
>= 0 && !(fattr
->valid
& NFS_ATTR_FATTR
)) {
171 msg
.rpc_proc
= &nfs3_procedures
[NFS3PROC_GETATTR
];
172 msg
.rpc_argp
= fhandle
;
173 msg
.rpc_resp
= fattr
;
174 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
176 dprintk("NFS reply lookup: %d\n", status
);
178 status
= nfs_refresh_inode(dir
, &dir_attr
);
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
);
257 * Create a regular file.
258 * For now, we don't implement O_EXCL.
261 nfs3_proc_create(struct inode
*dir
, struct dentry
*dentry
, struct iattr
*sattr
,
262 int flags
, struct nameidata
*nd
)
264 struct nfs_fh fhandle
;
265 struct nfs_fattr fattr
;
266 struct nfs_fattr dir_attr
;
267 struct nfs3_createargs arg
= {
269 .name
= dentry
->d_name
.name
,
270 .len
= dentry
->d_name
.len
,
273 struct nfs3_diropres res
= {
274 .dir_attr
= &dir_attr
,
278 struct rpc_message msg
= {
279 .rpc_proc
= &nfs3_procedures
[NFS3PROC_CREATE
],
283 mode_t mode
= sattr
->ia_mode
;
286 dprintk("NFS call create %s\n", dentry
->d_name
.name
);
287 arg
.createmode
= NFS3_CREATE_UNCHECKED
;
288 if (flags
& O_EXCL
) {
289 arg
.createmode
= NFS3_CREATE_EXCLUSIVE
;
290 arg
.verifier
[0] = jiffies
;
291 arg
.verifier
[1] = current
->pid
;
294 sattr
->ia_mode
&= ~current
->fs
->umask
;
297 nfs_fattr_init(&dir_attr
);
298 nfs_fattr_init(&fattr
);
299 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
300 nfs_refresh_inode(dir
, &dir_attr
);
302 /* If the server doesn't support the exclusive creation semantics,
303 * try again with simple 'guarded' mode. */
304 if (status
== -ENOTSUPP
) {
305 switch (arg
.createmode
) {
306 case NFS3_CREATE_EXCLUSIVE
:
307 arg
.createmode
= NFS3_CREATE_GUARDED
;
310 case NFS3_CREATE_GUARDED
:
311 arg
.createmode
= NFS3_CREATE_UNCHECKED
;
314 case NFS3_CREATE_UNCHECKED
:
321 status
= nfs_instantiate(dentry
, &fhandle
, &fattr
);
325 /* When we created the file with exclusive semantics, make
326 * sure we set the attributes afterwards. */
327 if (arg
.createmode
== NFS3_CREATE_EXCLUSIVE
) {
328 dprintk("NFS call setattr (post-create)\n");
330 if (!(sattr
->ia_valid
& ATTR_ATIME_SET
))
331 sattr
->ia_valid
|= ATTR_ATIME
;
332 if (!(sattr
->ia_valid
& ATTR_MTIME_SET
))
333 sattr
->ia_valid
|= ATTR_MTIME
;
335 /* Note: we could use a guarded setattr here, but I'm
336 * not sure this buys us anything (and I'd have
337 * to revamp the NFSv3 XDR code) */
338 status
= nfs3_proc_setattr(dentry
, &fattr
, sattr
);
340 nfs_setattr_update_inode(dentry
->d_inode
, sattr
);
341 nfs_refresh_inode(dentry
->d_inode
, &fattr
);
342 dprintk("NFS reply setattr (post-create): %d\n", status
);
346 status
= nfs3_proc_set_default_acl(dir
, dentry
->d_inode
, mode
);
348 dprintk("NFS reply create: %d\n", status
);
353 nfs3_proc_remove(struct inode
*dir
, struct qstr
*name
)
355 struct nfs_fattr dir_attr
;
356 struct nfs3_diropargs arg
= {
361 struct rpc_message msg
= {
362 .rpc_proc
= &nfs3_procedures
[NFS3PROC_REMOVE
],
364 .rpc_resp
= &dir_attr
,
368 dprintk("NFS call remove %s\n", name
->name
);
369 nfs_fattr_init(&dir_attr
);
370 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
371 nfs_post_op_update_inode(dir
, &dir_attr
);
372 dprintk("NFS reply remove: %d\n", status
);
377 nfs3_proc_unlink_setup(struct rpc_message
*msg
, struct dentry
*dir
, struct qstr
*name
)
380 struct nfs3_diropargs arg
;
381 struct nfs_fattr res
;
384 ptr
= kmalloc(sizeof(*ptr
), GFP_KERNEL
);
387 ptr
->arg
.fh
= NFS_FH(dir
->d_inode
);
388 ptr
->arg
.name
= name
->name
;
389 ptr
->arg
.len
= name
->len
;
390 nfs_fattr_init(&ptr
->res
);
391 msg
->rpc_proc
= &nfs3_procedures
[NFS3PROC_REMOVE
];
392 msg
->rpc_argp
= &ptr
->arg
;
393 msg
->rpc_resp
= &ptr
->res
;
398 nfs3_proc_unlink_done(struct dentry
*dir
, struct rpc_task
*task
)
400 struct rpc_message
*msg
= &task
->tk_msg
;
401 struct nfs_fattr
*dir_attr
;
403 if (nfs3_async_handle_jukebox(task
, dir
->d_inode
))
406 dir_attr
= (struct nfs_fattr
*)msg
->rpc_resp
;
407 nfs_post_op_update_inode(dir
->d_inode
, dir_attr
);
408 kfree(msg
->rpc_argp
);
414 nfs3_proc_rename(struct inode
*old_dir
, struct qstr
*old_name
,
415 struct inode
*new_dir
, struct qstr
*new_name
)
417 struct nfs_fattr old_dir_attr
, new_dir_attr
;
418 struct nfs3_renameargs arg
= {
419 .fromfh
= NFS_FH(old_dir
),
420 .fromname
= old_name
->name
,
421 .fromlen
= old_name
->len
,
422 .tofh
= NFS_FH(new_dir
),
423 .toname
= new_name
->name
,
424 .tolen
= new_name
->len
426 struct nfs3_renameres res
= {
427 .fromattr
= &old_dir_attr
,
428 .toattr
= &new_dir_attr
430 struct rpc_message msg
= {
431 .rpc_proc
= &nfs3_procedures
[NFS3PROC_RENAME
],
437 dprintk("NFS call rename %s -> %s\n", old_name
->name
, new_name
->name
);
438 nfs_fattr_init(&old_dir_attr
);
439 nfs_fattr_init(&new_dir_attr
);
440 status
= rpc_call_sync(NFS_CLIENT(old_dir
), &msg
, 0);
441 nfs_post_op_update_inode(old_dir
, &old_dir_attr
);
442 nfs_post_op_update_inode(new_dir
, &new_dir_attr
);
443 dprintk("NFS reply rename: %d\n", status
);
448 nfs3_proc_link(struct inode
*inode
, struct inode
*dir
, struct qstr
*name
)
450 struct nfs_fattr dir_attr
, fattr
;
451 struct nfs3_linkargs arg
= {
452 .fromfh
= NFS_FH(inode
),
454 .toname
= name
->name
,
457 struct nfs3_linkres res
= {
458 .dir_attr
= &dir_attr
,
461 struct rpc_message msg
= {
462 .rpc_proc
= &nfs3_procedures
[NFS3PROC_LINK
],
468 dprintk("NFS call link %s\n", name
->name
);
469 nfs_fattr_init(&dir_attr
);
470 nfs_fattr_init(&fattr
);
471 status
= rpc_call_sync(NFS_CLIENT(inode
), &msg
, 0);
472 nfs_post_op_update_inode(dir
, &dir_attr
);
473 nfs_post_op_update_inode(inode
, &fattr
);
474 dprintk("NFS reply link: %d\n", status
);
479 nfs3_proc_symlink(struct inode
*dir
, struct dentry
*dentry
, struct page
*page
,
480 unsigned int len
, struct iattr
*sattr
)
482 struct nfs_fh fhandle
;
483 struct nfs_fattr fattr
, dir_attr
;
484 struct nfs3_symlinkargs arg
= {
485 .fromfh
= NFS_FH(dir
),
486 .fromname
= dentry
->d_name
.name
,
487 .fromlen
= dentry
->d_name
.len
,
492 struct nfs3_diropres res
= {
493 .dir_attr
= &dir_attr
,
497 struct rpc_message msg
= {
498 .rpc_proc
= &nfs3_procedures
[NFS3PROC_SYMLINK
],
504 if (len
> NFS3_MAXPATHLEN
)
505 return -ENAMETOOLONG
;
507 dprintk("NFS call symlink %s\n", dentry
->d_name
.name
);
509 nfs_fattr_init(&dir_attr
);
510 nfs_fattr_init(&fattr
);
511 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
512 nfs_post_op_update_inode(dir
, &dir_attr
);
515 status
= nfs_instantiate(dentry
, &fhandle
, &fattr
);
517 dprintk("NFS reply symlink: %d\n", status
);
522 nfs3_proc_mkdir(struct inode
*dir
, struct dentry
*dentry
, struct iattr
*sattr
)
524 struct nfs_fh fhandle
;
525 struct nfs_fattr fattr
, dir_attr
;
526 struct nfs3_mkdirargs arg
= {
528 .name
= dentry
->d_name
.name
,
529 .len
= dentry
->d_name
.len
,
532 struct nfs3_diropres res
= {
533 .dir_attr
= &dir_attr
,
537 struct rpc_message msg
= {
538 .rpc_proc
= &nfs3_procedures
[NFS3PROC_MKDIR
],
542 int mode
= sattr
->ia_mode
;
545 dprintk("NFS call mkdir %s\n", dentry
->d_name
.name
);
547 sattr
->ia_mode
&= ~current
->fs
->umask
;
549 nfs_fattr_init(&dir_attr
);
550 nfs_fattr_init(&fattr
);
551 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
552 nfs_post_op_update_inode(dir
, &dir_attr
);
555 status
= nfs_instantiate(dentry
, &fhandle
, &fattr
);
558 status
= nfs3_proc_set_default_acl(dir
, dentry
->d_inode
, mode
);
560 dprintk("NFS reply mkdir: %d\n", status
);
565 nfs3_proc_rmdir(struct inode
*dir
, struct qstr
*name
)
567 struct nfs_fattr dir_attr
;
568 struct nfs3_diropargs arg
= {
573 struct rpc_message msg
= {
574 .rpc_proc
= &nfs3_procedures
[NFS3PROC_RMDIR
],
576 .rpc_resp
= &dir_attr
,
580 dprintk("NFS call rmdir %s\n", name
->name
);
581 nfs_fattr_init(&dir_attr
);
582 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
583 nfs_post_op_update_inode(dir
, &dir_attr
);
584 dprintk("NFS reply rmdir: %d\n", status
);
589 * The READDIR implementation is somewhat hackish - we pass the user buffer
590 * to the encode function, which installs it in the receive iovec.
591 * The decode function itself doesn't perform any decoding, it just makes
592 * sure the reply is syntactically correct.
594 * Also note that this implementation handles both plain readdir and
598 nfs3_proc_readdir(struct dentry
*dentry
, struct rpc_cred
*cred
,
599 u64 cookie
, struct page
*page
, unsigned int count
, int plus
)
601 struct inode
*dir
= dentry
->d_inode
;
602 struct nfs_fattr dir_attr
;
603 __be32
*verf
= NFS_COOKIEVERF(dir
);
604 struct nfs3_readdirargs arg
= {
607 .verf
= {verf
[0], verf
[1]},
612 struct nfs3_readdirres res
= {
613 .dir_attr
= &dir_attr
,
617 struct rpc_message msg
= {
618 .rpc_proc
= &nfs3_procedures
[NFS3PROC_READDIR
],
626 msg
.rpc_proc
= &nfs3_procedures
[NFS3PROC_READDIRPLUS
];
628 dprintk("NFS call readdir%s %d\n",
629 plus
? "plus" : "", (unsigned int) cookie
);
631 nfs_fattr_init(&dir_attr
);
632 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
633 nfs_refresh_inode(dir
, &dir_attr
);
634 dprintk("NFS reply readdir: %d\n", status
);
639 nfs3_proc_mknod(struct inode
*dir
, struct dentry
*dentry
, struct iattr
*sattr
,
643 struct nfs_fattr fattr
, dir_attr
;
644 struct nfs3_mknodargs arg
= {
646 .name
= dentry
->d_name
.name
,
647 .len
= dentry
->d_name
.len
,
651 struct nfs3_diropres res
= {
652 .dir_attr
= &dir_attr
,
656 struct rpc_message msg
= {
657 .rpc_proc
= &nfs3_procedures
[NFS3PROC_MKNOD
],
661 mode_t mode
= sattr
->ia_mode
;
664 switch (sattr
->ia_mode
& S_IFMT
) {
665 case S_IFBLK
: arg
.type
= NF3BLK
; break;
666 case S_IFCHR
: arg
.type
= NF3CHR
; break;
667 case S_IFIFO
: arg
.type
= NF3FIFO
; break;
668 case S_IFSOCK
: arg
.type
= NF3SOCK
; break;
669 default: return -EINVAL
;
672 dprintk("NFS call mknod %s %u:%u\n", dentry
->d_name
.name
,
673 MAJOR(rdev
), MINOR(rdev
));
675 sattr
->ia_mode
&= ~current
->fs
->umask
;
677 nfs_fattr_init(&dir_attr
);
678 nfs_fattr_init(&fattr
);
679 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
680 nfs_post_op_update_inode(dir
, &dir_attr
);
683 status
= nfs_instantiate(dentry
, &fh
, &fattr
);
686 status
= nfs3_proc_set_default_acl(dir
, dentry
->d_inode
, mode
);
688 dprintk("NFS reply mknod: %d\n", status
);
693 nfs3_proc_statfs(struct nfs_server
*server
, struct nfs_fh
*fhandle
,
694 struct nfs_fsstat
*stat
)
696 struct rpc_message msg
= {
697 .rpc_proc
= &nfs3_procedures
[NFS3PROC_FSSTAT
],
703 dprintk("NFS call fsstat\n");
704 nfs_fattr_init(stat
->fattr
);
705 status
= rpc_call_sync(server
->client
, &msg
, 0);
706 dprintk("NFS reply statfs: %d\n", status
);
711 nfs3_proc_fsinfo(struct nfs_server
*server
, struct nfs_fh
*fhandle
,
712 struct nfs_fsinfo
*info
)
714 struct rpc_message msg
= {
715 .rpc_proc
= &nfs3_procedures
[NFS3PROC_FSINFO
],
721 dprintk("NFS call fsinfo\n");
722 nfs_fattr_init(info
->fattr
);
723 status
= rpc_call_sync(server
->nfs_client
->cl_rpcclient
, &msg
, 0);
724 dprintk("NFS reply fsinfo: %d\n", status
);
729 nfs3_proc_pathconf(struct nfs_server
*server
, struct nfs_fh
*fhandle
,
730 struct nfs_pathconf
*info
)
732 struct rpc_message msg
= {
733 .rpc_proc
= &nfs3_procedures
[NFS3PROC_PATHCONF
],
739 dprintk("NFS call pathconf\n");
740 nfs_fattr_init(info
->fattr
);
741 status
= rpc_call_sync(server
->client
, &msg
, 0);
742 dprintk("NFS reply pathconf: %d\n", status
);
746 static int nfs3_read_done(struct rpc_task
*task
, struct nfs_read_data
*data
)
748 if (nfs3_async_handle_jukebox(task
, data
->inode
))
750 /* Call back common NFS readpage processing */
751 if (task
->tk_status
>= 0)
752 nfs_refresh_inode(data
->inode
, &data
->fattr
);
756 static void nfs3_proc_read_setup(struct nfs_read_data
*data
)
758 struct rpc_message msg
= {
759 .rpc_proc
= &nfs3_procedures
[NFS3PROC_READ
],
760 .rpc_argp
= &data
->args
,
761 .rpc_resp
= &data
->res
,
762 .rpc_cred
= data
->cred
,
765 rpc_call_setup(&data
->task
, &msg
, 0);
768 static int nfs3_write_done(struct rpc_task
*task
, struct nfs_write_data
*data
)
770 if (nfs3_async_handle_jukebox(task
, data
->inode
))
772 if (task
->tk_status
>= 0)
773 nfs_post_op_update_inode(data
->inode
, data
->res
.fattr
);
777 static void nfs3_proc_write_setup(struct nfs_write_data
*data
, int how
)
779 struct rpc_message msg
= {
780 .rpc_proc
= &nfs3_procedures
[NFS3PROC_WRITE
],
781 .rpc_argp
= &data
->args
,
782 .rpc_resp
= &data
->res
,
783 .rpc_cred
= data
->cred
,
786 data
->args
.stable
= NFS_UNSTABLE
;
787 if (how
& FLUSH_STABLE
) {
788 data
->args
.stable
= NFS_FILE_SYNC
;
789 if (NFS_I(data
->inode
)->ncommit
)
790 data
->args
.stable
= NFS_DATA_SYNC
;
793 /* Finalize the task. */
794 rpc_call_setup(&data
->task
, &msg
, 0);
797 static int nfs3_commit_done(struct rpc_task
*task
, struct nfs_write_data
*data
)
799 if (nfs3_async_handle_jukebox(task
, data
->inode
))
801 if (task
->tk_status
>= 0)
802 nfs_post_op_update_inode(data
->inode
, data
->res
.fattr
);
806 static void nfs3_proc_commit_setup(struct nfs_write_data
*data
, int how
)
808 struct rpc_message msg
= {
809 .rpc_proc
= &nfs3_procedures
[NFS3PROC_COMMIT
],
810 .rpc_argp
= &data
->args
,
811 .rpc_resp
= &data
->res
,
812 .rpc_cred
= data
->cred
,
815 rpc_call_setup(&data
->task
, &msg
, 0);
819 nfs3_proc_lock(struct file
*filp
, int cmd
, struct file_lock
*fl
)
821 return nlmclnt_proc(filp
->f_path
.dentry
->d_inode
, cmd
, fl
);
824 const struct nfs_rpc_ops nfs_v3_clientops
= {
825 .version
= 3, /* protocol version */
826 .dentry_ops
= &nfs_dentry_operations
,
827 .dir_inode_ops
= &nfs3_dir_inode_operations
,
828 .file_inode_ops
= &nfs3_file_inode_operations
,
829 .getroot
= nfs3_proc_get_root
,
830 .getattr
= nfs3_proc_getattr
,
831 .setattr
= nfs3_proc_setattr
,
832 .lookup
= nfs3_proc_lookup
,
833 .access
= nfs3_proc_access
,
834 .readlink
= nfs3_proc_readlink
,
835 .create
= nfs3_proc_create
,
836 .remove
= nfs3_proc_remove
,
837 .unlink_setup
= nfs3_proc_unlink_setup
,
838 .unlink_done
= nfs3_proc_unlink_done
,
839 .rename
= nfs3_proc_rename
,
840 .link
= nfs3_proc_link
,
841 .symlink
= nfs3_proc_symlink
,
842 .mkdir
= nfs3_proc_mkdir
,
843 .rmdir
= nfs3_proc_rmdir
,
844 .readdir
= nfs3_proc_readdir
,
845 .mknod
= nfs3_proc_mknod
,
846 .statfs
= nfs3_proc_statfs
,
847 .fsinfo
= nfs3_proc_fsinfo
,
848 .pathconf
= nfs3_proc_pathconf
,
849 .decode_dirent
= nfs3_decode_dirent
,
850 .read_setup
= nfs3_proc_read_setup
,
851 .read_done
= nfs3_read_done
,
852 .write_setup
= nfs3_proc_write_setup
,
853 .write_done
= nfs3_write_done
,
854 .commit_setup
= nfs3_proc_commit_setup
,
855 .commit_done
= nfs3_commit_done
,
856 .file_open
= nfs_open
,
857 .file_release
= nfs_release
,
858 .lock
= nfs3_proc_lock
,
859 .clear_acl_cache
= nfs3_forget_cached_acls
,