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>
21 #define NFSDBG_FACILITY NFSDBG_PROC
23 extern struct rpc_procinfo nfs3_procedures
[];
25 /* A wrapper to handle the EJUKEBOX error message */
27 nfs3_rpc_wrapper(struct rpc_clnt
*clnt
, struct rpc_message
*msg
, int flags
)
31 rpc_clnt_sigmask(clnt
, &oldset
);
33 res
= rpc_call_sync(clnt
, msg
, flags
);
36 set_current_state(TASK_INTERRUPTIBLE
);
37 schedule_timeout(NFS_JUKEBOX_RETRY_TIME
);
39 } while (!signalled());
40 rpc_clnt_sigunmask(clnt
, &oldset
);
45 nfs3_rpc_call_wrapper(struct rpc_clnt
*clnt
, u32 proc
, void *argp
, void *resp
, int flags
)
47 struct rpc_message msg
= {
48 .rpc_proc
= &nfs3_procedures
[proc
],
52 return nfs3_rpc_wrapper(clnt
, &msg
, flags
);
55 #define rpc_call(clnt, proc, argp, resp, flags) \
56 nfs3_rpc_call_wrapper(clnt, proc, argp, resp, flags)
57 #define rpc_call_sync(clnt, msg, flags) \
58 nfs3_rpc_wrapper(clnt, msg, flags)
61 nfs3_async_handle_jukebox(struct rpc_task
*task
)
63 if (task
->tk_status
!= -EJUKEBOX
)
66 rpc_restart_call(task
);
67 rpc_delay(task
, NFS_JUKEBOX_RETRY_TIME
);
72 * Bare-bones access to getattr: this is for nfs_read_super.
75 nfs3_proc_get_root(struct nfs_server
*server
, struct nfs_fh
*fhandle
,
76 struct nfs_fsinfo
*info
)
80 dprintk("%s: call fsinfo\n", __FUNCTION__
);
81 info
->fattr
->valid
= 0;
82 status
= rpc_call(server
->client_sys
, NFS3PROC_FSINFO
, fhandle
, info
, 0);
83 dprintk("%s: reply fsinfo: %d\n", __FUNCTION__
, status
);
84 if (!(info
->fattr
->valid
& NFS_ATTR_FATTR
)) {
85 status
= rpc_call(server
->client_sys
, NFS3PROC_GETATTR
, fhandle
, info
->fattr
, 0);
86 dprintk("%s: reply getattr: %d\n", __FUNCTION__
, status
);
92 * One function for each procedure in the NFS protocol.
95 nfs3_proc_getattr(struct nfs_server
*server
, struct nfs_fh
*fhandle
,
96 struct nfs_fattr
*fattr
)
100 dprintk("NFS call getattr\n");
102 status
= rpc_call(server
->client
, NFS3PROC_GETATTR
,
104 dprintk("NFS reply getattr: %d\n", status
);
109 nfs3_proc_setattr(struct dentry
*dentry
, struct nfs_fattr
*fattr
,
112 struct inode
*inode
= dentry
->d_inode
;
113 struct nfs3_sattrargs arg
= {
119 dprintk("NFS call setattr\n");
121 status
= rpc_call(NFS_CLIENT(inode
), NFS3PROC_SETATTR
, &arg
, fattr
, 0);
122 dprintk("NFS reply setattr: %d\n", status
);
127 nfs3_proc_lookup(struct inode
*dir
, struct qstr
*name
,
128 struct nfs_fh
*fhandle
, struct nfs_fattr
*fattr
)
130 struct nfs_fattr dir_attr
;
131 struct nfs3_diropargs arg
= {
136 struct nfs3_diropres res
= {
137 .dir_attr
= &dir_attr
,
143 dprintk("NFS call lookup %s\n", name
->name
);
146 status
= rpc_call(NFS_CLIENT(dir
), NFS3PROC_LOOKUP
, &arg
, &res
, 0);
147 if (status
>= 0 && !(fattr
->valid
& NFS_ATTR_FATTR
))
148 status
= rpc_call(NFS_CLIENT(dir
), NFS3PROC_GETATTR
,
150 dprintk("NFS reply lookup: %d\n", status
);
152 status
= nfs_refresh_inode(dir
, &dir_attr
);
156 static int nfs3_proc_access(struct inode
*inode
, struct nfs_access_entry
*entry
)
158 struct nfs_fattr fattr
;
159 struct nfs3_accessargs arg
= {
162 struct nfs3_accessres res
= {
165 struct rpc_message msg
= {
166 .rpc_proc
= &nfs3_procedures
[NFS3PROC_ACCESS
],
169 .rpc_cred
= entry
->cred
171 int mode
= entry
->mask
;
174 dprintk("NFS call access\n");
178 arg
.access
|= NFS3_ACCESS_READ
;
179 if (S_ISDIR(inode
->i_mode
)) {
180 if (mode
& MAY_WRITE
)
181 arg
.access
|= NFS3_ACCESS_MODIFY
| NFS3_ACCESS_EXTEND
| NFS3_ACCESS_DELETE
;
183 arg
.access
|= NFS3_ACCESS_LOOKUP
;
185 if (mode
& MAY_WRITE
)
186 arg
.access
|= NFS3_ACCESS_MODIFY
| NFS3_ACCESS_EXTEND
;
188 arg
.access
|= NFS3_ACCESS_EXECUTE
;
190 status
= rpc_call_sync(NFS_CLIENT(inode
), &msg
, 0);
191 nfs_refresh_inode(inode
, &fattr
);
194 if (res
.access
& NFS3_ACCESS_READ
)
195 entry
->mask
|= MAY_READ
;
196 if (res
.access
& (NFS3_ACCESS_MODIFY
| NFS3_ACCESS_EXTEND
| NFS3_ACCESS_DELETE
))
197 entry
->mask
|= MAY_WRITE
;
198 if (res
.access
& (NFS3_ACCESS_LOOKUP
|NFS3_ACCESS_EXECUTE
))
199 entry
->mask
|= MAY_EXEC
;
201 dprintk("NFS reply access: %d\n", status
);
205 static int nfs3_proc_readlink(struct inode
*inode
, struct page
*page
,
206 unsigned int pgbase
, unsigned int pglen
)
208 struct nfs_fattr fattr
;
209 struct nfs3_readlinkargs args
= {
217 dprintk("NFS call readlink\n");
219 status
= rpc_call(NFS_CLIENT(inode
), NFS3PROC_READLINK
,
221 nfs_refresh_inode(inode
, &fattr
);
222 dprintk("NFS reply readlink: %d\n", status
);
226 static int nfs3_proc_read(struct nfs_read_data
*rdata
)
228 int flags
= rdata
->flags
;
229 struct inode
* inode
= rdata
->inode
;
230 struct nfs_fattr
* fattr
= rdata
->res
.fattr
;
231 struct rpc_message msg
= {
232 .rpc_proc
= &nfs3_procedures
[NFS3PROC_READ
],
233 .rpc_argp
= &rdata
->args
,
234 .rpc_resp
= &rdata
->res
,
235 .rpc_cred
= rdata
->cred
,
239 dprintk("NFS call read %d @ %Ld\n", rdata
->args
.count
,
240 (long long) rdata
->args
.offset
);
242 status
= rpc_call_sync(NFS_CLIENT(inode
), &msg
, flags
);
244 nfs_refresh_inode(inode
, fattr
);
245 dprintk("NFS reply read: %d\n", status
);
249 static int nfs3_proc_write(struct nfs_write_data
*wdata
)
251 int rpcflags
= wdata
->flags
;
252 struct inode
* inode
= wdata
->inode
;
253 struct nfs_fattr
* fattr
= wdata
->res
.fattr
;
254 struct rpc_message msg
= {
255 .rpc_proc
= &nfs3_procedures
[NFS3PROC_WRITE
],
256 .rpc_argp
= &wdata
->args
,
257 .rpc_resp
= &wdata
->res
,
258 .rpc_cred
= wdata
->cred
,
262 dprintk("NFS call write %d @ %Ld\n", wdata
->args
.count
,
263 (long long) wdata
->args
.offset
);
265 status
= rpc_call_sync(NFS_CLIENT(inode
), &msg
, rpcflags
);
267 nfs_refresh_inode(inode
, fattr
);
268 dprintk("NFS reply write: %d\n", status
);
269 return status
< 0? status
: wdata
->res
.count
;
272 static int nfs3_proc_commit(struct nfs_write_data
*cdata
)
274 struct inode
* inode
= cdata
->inode
;
275 struct nfs_fattr
* fattr
= cdata
->res
.fattr
;
276 struct rpc_message msg
= {
277 .rpc_proc
= &nfs3_procedures
[NFS3PROC_COMMIT
],
278 .rpc_argp
= &cdata
->args
,
279 .rpc_resp
= &cdata
->res
,
280 .rpc_cred
= cdata
->cred
,
284 dprintk("NFS call commit %d @ %Ld\n", cdata
->args
.count
,
285 (long long) cdata
->args
.offset
);
287 status
= rpc_call_sync(NFS_CLIENT(inode
), &msg
, 0);
289 nfs_refresh_inode(inode
, fattr
);
290 dprintk("NFS reply commit: %d\n", status
);
295 * Create a regular file.
296 * For now, we don't implement O_EXCL.
299 nfs3_proc_create(struct inode
*dir
, struct dentry
*dentry
, struct iattr
*sattr
,
302 struct nfs_fh fhandle
;
303 struct nfs_fattr fattr
;
304 struct nfs_fattr dir_attr
;
305 struct nfs3_createargs arg
= {
307 .name
= dentry
->d_name
.name
,
308 .len
= dentry
->d_name
.len
,
311 struct nfs3_diropres res
= {
312 .dir_attr
= &dir_attr
,
318 dprintk("NFS call create %s\n", dentry
->d_name
.name
);
319 arg
.createmode
= NFS3_CREATE_UNCHECKED
;
320 if (flags
& O_EXCL
) {
321 arg
.createmode
= NFS3_CREATE_EXCLUSIVE
;
322 arg
.verifier
[0] = jiffies
;
323 arg
.verifier
[1] = current
->pid
;
329 status
= rpc_call(NFS_CLIENT(dir
), NFS3PROC_CREATE
, &arg
, &res
, 0);
330 nfs_refresh_inode(dir
, &dir_attr
);
332 /* If the server doesn't support the exclusive creation semantics,
333 * try again with simple 'guarded' mode. */
334 if (status
== NFSERR_NOTSUPP
) {
335 switch (arg
.createmode
) {
336 case NFS3_CREATE_EXCLUSIVE
:
337 arg
.createmode
= NFS3_CREATE_GUARDED
;
340 case NFS3_CREATE_GUARDED
:
341 arg
.createmode
= NFS3_CREATE_UNCHECKED
;
344 case NFS3_CREATE_UNCHECKED
:
351 status
= nfs_instantiate(dentry
, &fhandle
, &fattr
);
355 /* When we created the file with exclusive semantics, make
356 * sure we set the attributes afterwards. */
357 if (arg
.createmode
== NFS3_CREATE_EXCLUSIVE
) {
358 dprintk("NFS call setattr (post-create)\n");
360 if (!(sattr
->ia_valid
& ATTR_ATIME_SET
))
361 sattr
->ia_valid
|= ATTR_ATIME
;
362 if (!(sattr
->ia_valid
& ATTR_MTIME_SET
))
363 sattr
->ia_valid
|= ATTR_MTIME
;
365 /* Note: we could use a guarded setattr here, but I'm
366 * not sure this buys us anything (and I'd have
367 * to revamp the NFSv3 XDR code) */
368 status
= nfs3_proc_setattr(dentry
, &fattr
, sattr
);
369 nfs_refresh_inode(dentry
->d_inode
, &fattr
);
370 dprintk("NFS reply setattr (post-create): %d\n", status
);
373 dprintk("NFS reply create: %d\n", status
);
378 nfs3_proc_remove(struct inode
*dir
, struct qstr
*name
)
380 struct nfs_fattr dir_attr
;
381 struct nfs3_diropargs arg
= {
386 struct rpc_message msg
= {
387 .rpc_proc
= &nfs3_procedures
[NFS3PROC_REMOVE
],
389 .rpc_resp
= &dir_attr
,
393 dprintk("NFS call remove %s\n", name
->name
);
395 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
396 nfs_refresh_inode(dir
, &dir_attr
);
397 dprintk("NFS reply remove: %d\n", status
);
402 nfs3_proc_unlink_setup(struct rpc_message
*msg
, struct dentry
*dir
, struct qstr
*name
)
405 struct nfs3_diropargs arg
;
406 struct nfs_fattr res
;
409 ptr
= (struct unlinkxdr
*)kmalloc(sizeof(*ptr
), GFP_KERNEL
);
412 ptr
->arg
.fh
= NFS_FH(dir
->d_inode
);
413 ptr
->arg
.name
= name
->name
;
414 ptr
->arg
.len
= name
->len
;
416 msg
->rpc_proc
= &nfs3_procedures
[NFS3PROC_REMOVE
];
417 msg
->rpc_argp
= &ptr
->arg
;
418 msg
->rpc_resp
= &ptr
->res
;
423 nfs3_proc_unlink_done(struct dentry
*dir
, struct rpc_task
*task
)
425 struct rpc_message
*msg
= &task
->tk_msg
;
426 struct nfs_fattr
*dir_attr
;
428 if (nfs3_async_handle_jukebox(task
))
431 dir_attr
= (struct nfs_fattr
*)msg
->rpc_resp
;
432 nfs_refresh_inode(dir
->d_inode
, dir_attr
);
433 kfree(msg
->rpc_argp
);
439 nfs3_proc_rename(struct inode
*old_dir
, struct qstr
*old_name
,
440 struct inode
*new_dir
, struct qstr
*new_name
)
442 struct nfs_fattr old_dir_attr
, new_dir_attr
;
443 struct nfs3_renameargs arg
= {
444 .fromfh
= NFS_FH(old_dir
),
445 .fromname
= old_name
->name
,
446 .fromlen
= old_name
->len
,
447 .tofh
= NFS_FH(new_dir
),
448 .toname
= new_name
->name
,
449 .tolen
= new_name
->len
451 struct nfs3_renameres res
= {
452 .fromattr
= &old_dir_attr
,
453 .toattr
= &new_dir_attr
457 dprintk("NFS call rename %s -> %s\n", old_name
->name
, new_name
->name
);
458 old_dir_attr
.valid
= 0;
459 new_dir_attr
.valid
= 0;
460 status
= rpc_call(NFS_CLIENT(old_dir
), NFS3PROC_RENAME
, &arg
, &res
, 0);
461 nfs_refresh_inode(old_dir
, &old_dir_attr
);
462 nfs_refresh_inode(new_dir
, &new_dir_attr
);
463 dprintk("NFS reply rename: %d\n", status
);
468 nfs3_proc_link(struct inode
*inode
, struct inode
*dir
, struct qstr
*name
)
470 struct nfs_fattr dir_attr
, fattr
;
471 struct nfs3_linkargs arg
= {
472 .fromfh
= NFS_FH(inode
),
474 .toname
= name
->name
,
477 struct nfs3_linkres res
= {
478 .dir_attr
= &dir_attr
,
483 dprintk("NFS call link %s\n", name
->name
);
486 status
= rpc_call(NFS_CLIENT(inode
), NFS3PROC_LINK
, &arg
, &res
, 0);
487 nfs_refresh_inode(dir
, &dir_attr
);
488 nfs_refresh_inode(inode
, &fattr
);
489 dprintk("NFS reply link: %d\n", status
);
494 nfs3_proc_symlink(struct inode
*dir
, struct qstr
*name
, struct qstr
*path
,
495 struct iattr
*sattr
, struct nfs_fh
*fhandle
,
496 struct nfs_fattr
*fattr
)
498 struct nfs_fattr dir_attr
;
499 struct nfs3_symlinkargs arg
= {
500 .fromfh
= NFS_FH(dir
),
501 .fromname
= name
->name
,
502 .fromlen
= name
->len
,
503 .topath
= path
->name
,
507 struct nfs3_diropres res
= {
508 .dir_attr
= &dir_attr
,
514 if (path
->len
> NFS3_MAXPATHLEN
)
515 return -ENAMETOOLONG
;
516 dprintk("NFS call symlink %s -> %s\n", name
->name
, path
->name
);
519 status
= rpc_call(NFS_CLIENT(dir
), NFS3PROC_SYMLINK
, &arg
, &res
, 0);
520 nfs_refresh_inode(dir
, &dir_attr
);
521 dprintk("NFS reply symlink: %d\n", status
);
526 nfs3_proc_mkdir(struct inode
*dir
, struct dentry
*dentry
, struct iattr
*sattr
)
528 struct nfs_fh fhandle
;
529 struct nfs_fattr fattr
, dir_attr
;
530 struct nfs3_mkdirargs arg
= {
532 .name
= dentry
->d_name
.name
,
533 .len
= dentry
->d_name
.len
,
536 struct nfs3_diropres res
= {
537 .dir_attr
= &dir_attr
,
543 dprintk("NFS call mkdir %s\n", dentry
->d_name
.name
);
546 status
= rpc_call(NFS_CLIENT(dir
), NFS3PROC_MKDIR
, &arg
, &res
, 0);
547 nfs_refresh_inode(dir
, &dir_attr
);
549 status
= nfs_instantiate(dentry
, &fhandle
, &fattr
);
550 dprintk("NFS reply mkdir: %d\n", status
);
555 nfs3_proc_rmdir(struct inode
*dir
, struct qstr
*name
)
557 struct nfs_fattr dir_attr
;
558 struct nfs3_diropargs arg
= {
565 dprintk("NFS call rmdir %s\n", name
->name
);
567 status
= rpc_call(NFS_CLIENT(dir
), NFS3PROC_RMDIR
, &arg
, &dir_attr
, 0);
568 nfs_refresh_inode(dir
, &dir_attr
);
569 dprintk("NFS reply rmdir: %d\n", status
);
574 * The READDIR implementation is somewhat hackish - we pass the user buffer
575 * to the encode function, which installs it in the receive iovec.
576 * The decode function itself doesn't perform any decoding, it just makes
577 * sure the reply is syntactically correct.
579 * Also note that this implementation handles both plain readdir and
583 nfs3_proc_readdir(struct dentry
*dentry
, struct rpc_cred
*cred
,
584 u64 cookie
, struct page
*page
, unsigned int count
, int plus
)
586 struct inode
*dir
= dentry
->d_inode
;
587 struct nfs_fattr dir_attr
;
588 u32
*verf
= NFS_COOKIEVERF(dir
);
589 struct nfs3_readdirargs arg
= {
592 .verf
= {verf
[0], verf
[1]},
597 struct nfs3_readdirres res
= {
598 .dir_attr
= &dir_attr
,
602 struct rpc_message msg
= {
603 .rpc_proc
= &nfs3_procedures
[NFS3PROC_READDIR
],
613 msg
.rpc_proc
= &nfs3_procedures
[NFS3PROC_READDIRPLUS
];
615 dprintk("NFS call readdir%s %d\n",
616 plus
? "plus" : "", (unsigned int) cookie
);
619 status
= rpc_call_sync(NFS_CLIENT(dir
), &msg
, 0);
620 nfs_refresh_inode(dir
, &dir_attr
);
621 dprintk("NFS reply readdir: %d\n", status
);
627 nfs3_proc_mknod(struct inode
*dir
, struct dentry
*dentry
, struct iattr
*sattr
,
631 struct nfs_fattr fattr
, dir_attr
;
632 struct nfs3_mknodargs arg
= {
634 .name
= dentry
->d_name
.name
,
635 .len
= dentry
->d_name
.len
,
639 struct nfs3_diropres res
= {
640 .dir_attr
= &dir_attr
,
646 switch (sattr
->ia_mode
& S_IFMT
) {
647 case S_IFBLK
: arg
.type
= NF3BLK
; break;
648 case S_IFCHR
: arg
.type
= NF3CHR
; break;
649 case S_IFIFO
: arg
.type
= NF3FIFO
; break;
650 case S_IFSOCK
: arg
.type
= NF3SOCK
; break;
651 default: return -EINVAL
;
654 dprintk("NFS call mknod %s %u:%u\n", dentry
->d_name
.name
,
655 MAJOR(rdev
), MINOR(rdev
));
658 status
= rpc_call(NFS_CLIENT(dir
), NFS3PROC_MKNOD
, &arg
, &res
, 0);
659 nfs_refresh_inode(dir
, &dir_attr
);
661 status
= nfs_instantiate(dentry
, &fh
, &fattr
);
662 dprintk("NFS reply mknod: %d\n", status
);
667 nfs3_proc_statfs(struct nfs_server
*server
, struct nfs_fh
*fhandle
,
668 struct nfs_fsstat
*stat
)
672 dprintk("NFS call fsstat\n");
673 stat
->fattr
->valid
= 0;
674 status
= rpc_call(server
->client
, NFS3PROC_FSSTAT
, fhandle
, stat
, 0);
675 dprintk("NFS reply statfs: %d\n", status
);
680 nfs3_proc_fsinfo(struct nfs_server
*server
, struct nfs_fh
*fhandle
,
681 struct nfs_fsinfo
*info
)
685 dprintk("NFS call fsinfo\n");
686 info
->fattr
->valid
= 0;
687 status
= rpc_call(server
->client_sys
, NFS3PROC_FSINFO
, fhandle
, info
, 0);
688 dprintk("NFS reply fsinfo: %d\n", status
);
693 nfs3_proc_pathconf(struct nfs_server
*server
, struct nfs_fh
*fhandle
,
694 struct nfs_pathconf
*info
)
698 dprintk("NFS call pathconf\n");
699 info
->fattr
->valid
= 0;
700 status
= rpc_call(server
->client
, NFS3PROC_PATHCONF
, fhandle
, info
, 0);
701 dprintk("NFS reply pathconf: %d\n", status
);
705 extern u32
*nfs3_decode_dirent(u32
*, struct nfs_entry
*, int);
708 nfs3_read_done(struct rpc_task
*task
)
710 struct nfs_write_data
*data
= (struct nfs_write_data
*) task
->tk_calldata
;
712 if (nfs3_async_handle_jukebox(task
))
714 /* Call back common NFS readpage processing */
715 if (task
->tk_status
>= 0)
716 nfs_refresh_inode(data
->inode
, &data
->fattr
);
717 nfs_readpage_result(task
);
721 nfs3_proc_read_setup(struct nfs_read_data
*data
)
723 struct rpc_task
*task
= &data
->task
;
724 struct inode
*inode
= data
->inode
;
726 struct rpc_message msg
= {
727 .rpc_proc
= &nfs3_procedures
[NFS3PROC_READ
],
728 .rpc_argp
= &data
->args
,
729 .rpc_resp
= &data
->res
,
730 .rpc_cred
= data
->cred
,
733 /* N.B. Do we need to test? Never called for swapfile inode */
734 flags
= RPC_TASK_ASYNC
| (IS_SWAPFILE(inode
)? NFS_RPC_SWAPFLAGS
: 0);
736 /* Finalize the task. */
737 rpc_init_task(task
, NFS_CLIENT(inode
), nfs3_read_done
, flags
);
738 rpc_call_setup(task
, &msg
, 0);
742 nfs3_write_done(struct rpc_task
*task
)
744 struct nfs_write_data
*data
;
746 if (nfs3_async_handle_jukebox(task
))
748 data
= (struct nfs_write_data
*)task
->tk_calldata
;
749 if (task
->tk_status
>= 0)
750 nfs_refresh_inode(data
->inode
, data
->res
.fattr
);
751 nfs_writeback_done(task
);
755 nfs3_proc_write_setup(struct nfs_write_data
*data
, int how
)
757 struct rpc_task
*task
= &data
->task
;
758 struct inode
*inode
= data
->inode
;
761 struct rpc_message msg
= {
762 .rpc_proc
= &nfs3_procedures
[NFS3PROC_WRITE
],
763 .rpc_argp
= &data
->args
,
764 .rpc_resp
= &data
->res
,
765 .rpc_cred
= data
->cred
,
768 if (how
& FLUSH_STABLE
) {
769 if (!NFS_I(inode
)->ncommit
)
770 stable
= NFS_FILE_SYNC
;
772 stable
= NFS_DATA_SYNC
;
774 stable
= NFS_UNSTABLE
;
775 data
->args
.stable
= stable
;
777 /* Set the initial flags for the task. */
778 flags
= (how
& FLUSH_SYNC
) ? 0 : RPC_TASK_ASYNC
;
780 /* Finalize the task. */
781 rpc_init_task(task
, NFS_CLIENT(inode
), nfs3_write_done
, flags
);
782 rpc_call_setup(task
, &msg
, 0);
786 nfs3_commit_done(struct rpc_task
*task
)
788 struct nfs_write_data
*data
;
790 if (nfs3_async_handle_jukebox(task
))
792 data
= (struct nfs_write_data
*)task
->tk_calldata
;
793 if (task
->tk_status
>= 0)
794 nfs_refresh_inode(data
->inode
, data
->res
.fattr
);
795 nfs_commit_done(task
);
799 nfs3_proc_commit_setup(struct nfs_write_data
*data
, int how
)
801 struct rpc_task
*task
= &data
->task
;
802 struct inode
*inode
= data
->inode
;
804 struct rpc_message msg
= {
805 .rpc_proc
= &nfs3_procedures
[NFS3PROC_COMMIT
],
806 .rpc_argp
= &data
->args
,
807 .rpc_resp
= &data
->res
,
808 .rpc_cred
= data
->cred
,
811 /* Set the initial flags for the task. */
812 flags
= (how
& FLUSH_SYNC
) ? 0 : RPC_TASK_ASYNC
;
814 /* Finalize the task. */
815 rpc_init_task(task
, NFS_CLIENT(inode
), nfs3_commit_done
, flags
);
816 rpc_call_setup(task
, &msg
, 0);
820 nfs3_proc_lock(struct file
*filp
, int cmd
, struct file_lock
*fl
)
822 return nlmclnt_proc(filp
->f_dentry
->d_inode
, cmd
, fl
);
825 struct nfs_rpc_ops nfs_v3_clientops
= {
826 .version
= 3, /* protocol version */
827 .dentry_ops
= &nfs_dentry_operations
,
828 .dir_inode_ops
= &nfs_dir_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 .read
= nfs3_proc_read
,
836 .write
= nfs3_proc_write
,
837 .commit
= nfs3_proc_commit
,
838 .create
= nfs3_proc_create
,
839 .remove
= nfs3_proc_remove
,
840 .unlink_setup
= nfs3_proc_unlink_setup
,
841 .unlink_done
= nfs3_proc_unlink_done
,
842 .rename
= nfs3_proc_rename
,
843 .link
= nfs3_proc_link
,
844 .symlink
= nfs3_proc_symlink
,
845 .mkdir
= nfs3_proc_mkdir
,
846 .rmdir
= nfs3_proc_rmdir
,
847 .readdir
= nfs3_proc_readdir
,
848 .mknod
= nfs3_proc_mknod
,
849 .statfs
= nfs3_proc_statfs
,
850 .fsinfo
= nfs3_proc_fsinfo
,
851 .pathconf
= nfs3_proc_pathconf
,
852 .decode_dirent
= nfs3_decode_dirent
,
853 .read_setup
= nfs3_proc_read_setup
,
854 .write_setup
= nfs3_proc_write_setup
,
855 .commit_setup
= nfs3_proc_commit_setup
,
856 .file_open
= nfs_open
,
857 .file_release
= nfs_release
,
858 .lock
= nfs3_proc_lock
,