diff options
Diffstat (limited to 'fs/nfs/nfs3proc.c')
-rw-r--r-- | fs/nfs/nfs3proc.c | 246 |
1 files changed, 133 insertions, 113 deletions
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index ed67567f0556..cf186f0d2b3b 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
@@ -19,6 +19,8 @@ | |||
19 | #include <linux/smp_lock.h> | 19 | #include <linux/smp_lock.h> |
20 | #include <linux/nfs_mount.h> | 20 | #include <linux/nfs_mount.h> |
21 | 21 | ||
22 | #include "iostat.h" | ||
23 | |||
22 | #define NFSDBG_FACILITY NFSDBG_PROC | 24 | #define NFSDBG_FACILITY NFSDBG_PROC |
23 | 25 | ||
24 | extern struct rpc_procinfo nfs3_procedures[]; | 26 | extern struct rpc_procinfo nfs3_procedures[]; |
@@ -41,27 +43,14 @@ nfs3_rpc_wrapper(struct rpc_clnt *clnt, struct rpc_message *msg, int flags) | |||
41 | return res; | 43 | return res; |
42 | } | 44 | } |
43 | 45 | ||
44 | static inline int | 46 | #define rpc_call_sync(clnt, msg, flags) nfs3_rpc_wrapper(clnt, msg, flags) |
45 | nfs3_rpc_call_wrapper(struct rpc_clnt *clnt, u32 proc, void *argp, void *resp, int flags) | ||
46 | { | ||
47 | struct rpc_message msg = { | ||
48 | .rpc_proc = &clnt->cl_procinfo[proc], | ||
49 | .rpc_argp = argp, | ||
50 | .rpc_resp = resp, | ||
51 | }; | ||
52 | return nfs3_rpc_wrapper(clnt, &msg, flags); | ||
53 | } | ||
54 | |||
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) | ||
59 | 47 | ||
60 | static int | 48 | static int |
61 | nfs3_async_handle_jukebox(struct rpc_task *task) | 49 | nfs3_async_handle_jukebox(struct rpc_task *task, struct inode *inode) |
62 | { | 50 | { |
63 | if (task->tk_status != -EJUKEBOX) | 51 | if (task->tk_status != -EJUKEBOX) |
64 | return 0; | 52 | return 0; |
53 | nfs_inc_stats(inode, NFSIOS_DELAY); | ||
65 | task->tk_status = 0; | 54 | task->tk_status = 0; |
66 | rpc_restart_call(task); | 55 | rpc_restart_call(task); |
67 | rpc_delay(task, NFS_JUKEBOX_RETRY_TIME); | 56 | rpc_delay(task, NFS_JUKEBOX_RETRY_TIME); |
@@ -72,14 +61,21 @@ static int | |||
72 | do_proc_get_root(struct rpc_clnt *client, struct nfs_fh *fhandle, | 61 | do_proc_get_root(struct rpc_clnt *client, struct nfs_fh *fhandle, |
73 | struct nfs_fsinfo *info) | 62 | struct nfs_fsinfo *info) |
74 | { | 63 | { |
64 | struct rpc_message msg = { | ||
65 | .rpc_proc = &nfs3_procedures[NFS3PROC_FSINFO], | ||
66 | .rpc_argp = fhandle, | ||
67 | .rpc_resp = info, | ||
68 | }; | ||
75 | int status; | 69 | int status; |
76 | 70 | ||
77 | dprintk("%s: call fsinfo\n", __FUNCTION__); | 71 | dprintk("%s: call fsinfo\n", __FUNCTION__); |
78 | nfs_fattr_init(info->fattr); | 72 | nfs_fattr_init(info->fattr); |
79 | status = rpc_call(client, NFS3PROC_FSINFO, fhandle, info, 0); | 73 | status = rpc_call_sync(client, &msg, 0); |
80 | dprintk("%s: reply fsinfo: %d\n", __FUNCTION__, status); | 74 | dprintk("%s: reply fsinfo: %d\n", __FUNCTION__, status); |
81 | if (!(info->fattr->valid & NFS_ATTR_FATTR)) { | 75 | if (!(info->fattr->valid & NFS_ATTR_FATTR)) { |
82 | status = rpc_call(client, NFS3PROC_GETATTR, fhandle, info->fattr, 0); | 76 | msg.rpc_proc = &nfs3_procedures[NFS3PROC_GETATTR]; |
77 | msg.rpc_resp = info->fattr; | ||
78 | status = rpc_call_sync(client, &msg, 0); | ||
83 | dprintk("%s: reply getattr: %d\n", __FUNCTION__, status); | 79 | dprintk("%s: reply getattr: %d\n", __FUNCTION__, status); |
84 | } | 80 | } |
85 | return status; | 81 | return status; |
@@ -107,12 +103,16 @@ static int | |||
107 | nfs3_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, | 103 | nfs3_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, |
108 | struct nfs_fattr *fattr) | 104 | struct nfs_fattr *fattr) |
109 | { | 105 | { |
106 | struct rpc_message msg = { | ||
107 | .rpc_proc = &nfs3_procedures[NFS3PROC_GETATTR], | ||
108 | .rpc_argp = fhandle, | ||
109 | .rpc_resp = fattr, | ||
110 | }; | ||
110 | int status; | 111 | int status; |
111 | 112 | ||
112 | dprintk("NFS call getattr\n"); | 113 | dprintk("NFS call getattr\n"); |
113 | nfs_fattr_init(fattr); | 114 | nfs_fattr_init(fattr); |
114 | status = rpc_call(server->client, NFS3PROC_GETATTR, | 115 | status = rpc_call_sync(server->client, &msg, 0); |
115 | fhandle, fattr, 0); | ||
116 | dprintk("NFS reply getattr: %d\n", status); | 116 | dprintk("NFS reply getattr: %d\n", status); |
117 | return status; | 117 | return status; |
118 | } | 118 | } |
@@ -126,11 +126,16 @@ nfs3_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, | |||
126 | .fh = NFS_FH(inode), | 126 | .fh = NFS_FH(inode), |
127 | .sattr = sattr, | 127 | .sattr = sattr, |
128 | }; | 128 | }; |
129 | struct rpc_message msg = { | ||
130 | .rpc_proc = &nfs3_procedures[NFS3PROC_SETATTR], | ||
131 | .rpc_argp = &arg, | ||
132 | .rpc_resp = fattr, | ||
133 | }; | ||
129 | int status; | 134 | int status; |
130 | 135 | ||
131 | dprintk("NFS call setattr\n"); | 136 | dprintk("NFS call setattr\n"); |
132 | nfs_fattr_init(fattr); | 137 | nfs_fattr_init(fattr); |
133 | status = rpc_call(NFS_CLIENT(inode), NFS3PROC_SETATTR, &arg, fattr, 0); | 138 | status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); |
134 | if (status == 0) | 139 | if (status == 0) |
135 | nfs_setattr_update_inode(inode, sattr); | 140 | nfs_setattr_update_inode(inode, sattr); |
136 | dprintk("NFS reply setattr: %d\n", status); | 141 | dprintk("NFS reply setattr: %d\n", status); |
@@ -152,15 +157,23 @@ nfs3_proc_lookup(struct inode *dir, struct qstr *name, | |||
152 | .fh = fhandle, | 157 | .fh = fhandle, |
153 | .fattr = fattr | 158 | .fattr = fattr |
154 | }; | 159 | }; |
160 | struct rpc_message msg = { | ||
161 | .rpc_proc = &nfs3_procedures[NFS3PROC_LOOKUP], | ||
162 | .rpc_argp = &arg, | ||
163 | .rpc_resp = &res, | ||
164 | }; | ||
155 | int status; | 165 | int status; |
156 | 166 | ||
157 | dprintk("NFS call lookup %s\n", name->name); | 167 | dprintk("NFS call lookup %s\n", name->name); |
158 | nfs_fattr_init(&dir_attr); | 168 | nfs_fattr_init(&dir_attr); |
159 | nfs_fattr_init(fattr); | 169 | nfs_fattr_init(fattr); |
160 | status = rpc_call(NFS_CLIENT(dir), NFS3PROC_LOOKUP, &arg, &res, 0); | 170 | status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); |
161 | if (status >= 0 && !(fattr->valid & NFS_ATTR_FATTR)) | 171 | if (status >= 0 && !(fattr->valid & NFS_ATTR_FATTR)) { |
162 | status = rpc_call(NFS_CLIENT(dir), NFS3PROC_GETATTR, | 172 | msg.rpc_proc = &nfs3_procedures[NFS3PROC_GETATTR]; |
163 | fhandle, fattr, 0); | 173 | msg.rpc_argp = fhandle; |
174 | msg.rpc_resp = fattr; | ||
175 | status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); | ||
176 | } | ||
164 | dprintk("NFS reply lookup: %d\n", status); | 177 | dprintk("NFS reply lookup: %d\n", status); |
165 | if (status >= 0) | 178 | if (status >= 0) |
166 | status = nfs_refresh_inode(dir, &dir_attr); | 179 | status = nfs_refresh_inode(dir, &dir_attr); |
@@ -180,7 +193,7 @@ static int nfs3_proc_access(struct inode *inode, struct nfs_access_entry *entry) | |||
180 | .rpc_proc = &nfs3_procedures[NFS3PROC_ACCESS], | 193 | .rpc_proc = &nfs3_procedures[NFS3PROC_ACCESS], |
181 | .rpc_argp = &arg, | 194 | .rpc_argp = &arg, |
182 | .rpc_resp = &res, | 195 | .rpc_resp = &res, |
183 | .rpc_cred = entry->cred | 196 | .rpc_cred = entry->cred, |
184 | }; | 197 | }; |
185 | int mode = entry->mask; | 198 | int mode = entry->mask; |
186 | int status; | 199 | int status; |
@@ -226,12 +239,16 @@ static int nfs3_proc_readlink(struct inode *inode, struct page *page, | |||
226 | .pglen = pglen, | 239 | .pglen = pglen, |
227 | .pages = &page | 240 | .pages = &page |
228 | }; | 241 | }; |
242 | struct rpc_message msg = { | ||
243 | .rpc_proc = &nfs3_procedures[NFS3PROC_READLINK], | ||
244 | .rpc_argp = &args, | ||
245 | .rpc_resp = &fattr, | ||
246 | }; | ||
229 | int status; | 247 | int status; |
230 | 248 | ||
231 | dprintk("NFS call readlink\n"); | 249 | dprintk("NFS call readlink\n"); |
232 | nfs_fattr_init(&fattr); | 250 | nfs_fattr_init(&fattr); |
233 | status = rpc_call(NFS_CLIENT(inode), NFS3PROC_READLINK, | 251 | status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); |
234 | &args, &fattr, 0); | ||
235 | nfs_refresh_inode(inode, &fattr); | 252 | nfs_refresh_inode(inode, &fattr); |
236 | dprintk("NFS reply readlink: %d\n", status); | 253 | dprintk("NFS reply readlink: %d\n", status); |
237 | return status; | 254 | return status; |
@@ -327,6 +344,11 @@ nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, | |||
327 | .fh = &fhandle, | 344 | .fh = &fhandle, |
328 | .fattr = &fattr | 345 | .fattr = &fattr |
329 | }; | 346 | }; |
347 | struct rpc_message msg = { | ||
348 | .rpc_proc = &nfs3_procedures[NFS3PROC_CREATE], | ||
349 | .rpc_argp = &arg, | ||
350 | .rpc_resp = &res, | ||
351 | }; | ||
330 | mode_t mode = sattr->ia_mode; | 352 | mode_t mode = sattr->ia_mode; |
331 | int status; | 353 | int status; |
332 | 354 | ||
@@ -343,8 +365,8 @@ nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, | |||
343 | again: | 365 | again: |
344 | nfs_fattr_init(&dir_attr); | 366 | nfs_fattr_init(&dir_attr); |
345 | nfs_fattr_init(&fattr); | 367 | nfs_fattr_init(&fattr); |
346 | status = rpc_call(NFS_CLIENT(dir), NFS3PROC_CREATE, &arg, &res, 0); | 368 | status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); |
347 | nfs_post_op_update_inode(dir, &dir_attr); | 369 | nfs_refresh_inode(dir, &dir_attr); |
348 | 370 | ||
349 | /* If the server doesn't support the exclusive creation semantics, | 371 | /* If the server doesn't support the exclusive creation semantics, |
350 | * try again with simple 'guarded' mode. */ | 372 | * try again with simple 'guarded' mode. */ |
@@ -447,7 +469,7 @@ nfs3_proc_unlink_done(struct dentry *dir, struct rpc_task *task) | |||
447 | struct rpc_message *msg = &task->tk_msg; | 469 | struct rpc_message *msg = &task->tk_msg; |
448 | struct nfs_fattr *dir_attr; | 470 | struct nfs_fattr *dir_attr; |
449 | 471 | ||
450 | if (nfs3_async_handle_jukebox(task)) | 472 | if (nfs3_async_handle_jukebox(task, dir->d_inode)) |
451 | return 1; | 473 | return 1; |
452 | if (msg->rpc_argp) { | 474 | if (msg->rpc_argp) { |
453 | dir_attr = (struct nfs_fattr*)msg->rpc_resp; | 475 | dir_attr = (struct nfs_fattr*)msg->rpc_resp; |
@@ -474,12 +496,17 @@ nfs3_proc_rename(struct inode *old_dir, struct qstr *old_name, | |||
474 | .fromattr = &old_dir_attr, | 496 | .fromattr = &old_dir_attr, |
475 | .toattr = &new_dir_attr | 497 | .toattr = &new_dir_attr |
476 | }; | 498 | }; |
499 | struct rpc_message msg = { | ||
500 | .rpc_proc = &nfs3_procedures[NFS3PROC_RENAME], | ||
501 | .rpc_argp = &arg, | ||
502 | .rpc_resp = &res, | ||
503 | }; | ||
477 | int status; | 504 | int status; |
478 | 505 | ||
479 | dprintk("NFS call rename %s -> %s\n", old_name->name, new_name->name); | 506 | dprintk("NFS call rename %s -> %s\n", old_name->name, new_name->name); |
480 | nfs_fattr_init(&old_dir_attr); | 507 | nfs_fattr_init(&old_dir_attr); |
481 | nfs_fattr_init(&new_dir_attr); | 508 | nfs_fattr_init(&new_dir_attr); |
482 | status = rpc_call(NFS_CLIENT(old_dir), NFS3PROC_RENAME, &arg, &res, 0); | 509 | status = rpc_call_sync(NFS_CLIENT(old_dir), &msg, 0); |
483 | nfs_post_op_update_inode(old_dir, &old_dir_attr); | 510 | nfs_post_op_update_inode(old_dir, &old_dir_attr); |
484 | nfs_post_op_update_inode(new_dir, &new_dir_attr); | 511 | nfs_post_op_update_inode(new_dir, &new_dir_attr); |
485 | dprintk("NFS reply rename: %d\n", status); | 512 | dprintk("NFS reply rename: %d\n", status); |
@@ -500,12 +527,17 @@ nfs3_proc_link(struct inode *inode, struct inode *dir, struct qstr *name) | |||
500 | .dir_attr = &dir_attr, | 527 | .dir_attr = &dir_attr, |
501 | .fattr = &fattr | 528 | .fattr = &fattr |
502 | }; | 529 | }; |
530 | struct rpc_message msg = { | ||
531 | .rpc_proc = &nfs3_procedures[NFS3PROC_LINK], | ||
532 | .rpc_argp = &arg, | ||
533 | .rpc_resp = &res, | ||
534 | }; | ||
503 | int status; | 535 | int status; |
504 | 536 | ||
505 | dprintk("NFS call link %s\n", name->name); | 537 | dprintk("NFS call link %s\n", name->name); |
506 | nfs_fattr_init(&dir_attr); | 538 | nfs_fattr_init(&dir_attr); |
507 | nfs_fattr_init(&fattr); | 539 | nfs_fattr_init(&fattr); |
508 | status = rpc_call(NFS_CLIENT(inode), NFS3PROC_LINK, &arg, &res, 0); | 540 | status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); |
509 | nfs_post_op_update_inode(dir, &dir_attr); | 541 | nfs_post_op_update_inode(dir, &dir_attr); |
510 | nfs_post_op_update_inode(inode, &fattr); | 542 | nfs_post_op_update_inode(inode, &fattr); |
511 | dprintk("NFS reply link: %d\n", status); | 543 | dprintk("NFS reply link: %d\n", status); |
@@ -531,6 +563,11 @@ nfs3_proc_symlink(struct inode *dir, struct qstr *name, struct qstr *path, | |||
531 | .fh = fhandle, | 563 | .fh = fhandle, |
532 | .fattr = fattr | 564 | .fattr = fattr |
533 | }; | 565 | }; |
566 | struct rpc_message msg = { | ||
567 | .rpc_proc = &nfs3_procedures[NFS3PROC_SYMLINK], | ||
568 | .rpc_argp = &arg, | ||
569 | .rpc_resp = &res, | ||
570 | }; | ||
534 | int status; | 571 | int status; |
535 | 572 | ||
536 | if (path->len > NFS3_MAXPATHLEN) | 573 | if (path->len > NFS3_MAXPATHLEN) |
@@ -538,7 +575,7 @@ nfs3_proc_symlink(struct inode *dir, struct qstr *name, struct qstr *path, | |||
538 | dprintk("NFS call symlink %s -> %s\n", name->name, path->name); | 575 | dprintk("NFS call symlink %s -> %s\n", name->name, path->name); |
539 | nfs_fattr_init(&dir_attr); | 576 | nfs_fattr_init(&dir_attr); |
540 | nfs_fattr_init(fattr); | 577 | nfs_fattr_init(fattr); |
541 | status = rpc_call(NFS_CLIENT(dir), NFS3PROC_SYMLINK, &arg, &res, 0); | 578 | status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); |
542 | nfs_post_op_update_inode(dir, &dir_attr); | 579 | nfs_post_op_update_inode(dir, &dir_attr); |
543 | dprintk("NFS reply symlink: %d\n", status); | 580 | dprintk("NFS reply symlink: %d\n", status); |
544 | return status; | 581 | return status; |
@@ -560,6 +597,11 @@ nfs3_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr) | |||
560 | .fh = &fhandle, | 597 | .fh = &fhandle, |
561 | .fattr = &fattr | 598 | .fattr = &fattr |
562 | }; | 599 | }; |
600 | struct rpc_message msg = { | ||
601 | .rpc_proc = &nfs3_procedures[NFS3PROC_MKDIR], | ||
602 | .rpc_argp = &arg, | ||
603 | .rpc_resp = &res, | ||
604 | }; | ||
563 | int mode = sattr->ia_mode; | 605 | int mode = sattr->ia_mode; |
564 | int status; | 606 | int status; |
565 | 607 | ||
@@ -569,7 +611,7 @@ nfs3_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr) | |||
569 | 611 | ||
570 | nfs_fattr_init(&dir_attr); | 612 | nfs_fattr_init(&dir_attr); |
571 | nfs_fattr_init(&fattr); | 613 | nfs_fattr_init(&fattr); |
572 | status = rpc_call(NFS_CLIENT(dir), NFS3PROC_MKDIR, &arg, &res, 0); | 614 | status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); |
573 | nfs_post_op_update_inode(dir, &dir_attr); | 615 | nfs_post_op_update_inode(dir, &dir_attr); |
574 | if (status != 0) | 616 | if (status != 0) |
575 | goto out; | 617 | goto out; |
@@ -591,11 +633,16 @@ nfs3_proc_rmdir(struct inode *dir, struct qstr *name) | |||
591 | .name = name->name, | 633 | .name = name->name, |
592 | .len = name->len | 634 | .len = name->len |
593 | }; | 635 | }; |
636 | struct rpc_message msg = { | ||
637 | .rpc_proc = &nfs3_procedures[NFS3PROC_RMDIR], | ||
638 | .rpc_argp = &arg, | ||
639 | .rpc_resp = &dir_attr, | ||
640 | }; | ||
594 | int status; | 641 | int status; |
595 | 642 | ||
596 | dprintk("NFS call rmdir %s\n", name->name); | 643 | dprintk("NFS call rmdir %s\n", name->name); |
597 | nfs_fattr_init(&dir_attr); | 644 | nfs_fattr_init(&dir_attr); |
598 | status = rpc_call(NFS_CLIENT(dir), NFS3PROC_RMDIR, &arg, &dir_attr, 0); | 645 | status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); |
599 | nfs_post_op_update_inode(dir, &dir_attr); | 646 | nfs_post_op_update_inode(dir, &dir_attr); |
600 | dprintk("NFS reply rmdir: %d\n", status); | 647 | dprintk("NFS reply rmdir: %d\n", status); |
601 | return status; | 648 | return status; |
@@ -672,6 +719,11 @@ nfs3_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr, | |||
672 | .fh = &fh, | 719 | .fh = &fh, |
673 | .fattr = &fattr | 720 | .fattr = &fattr |
674 | }; | 721 | }; |
722 | struct rpc_message msg = { | ||
723 | .rpc_proc = &nfs3_procedures[NFS3PROC_MKNOD], | ||
724 | .rpc_argp = &arg, | ||
725 | .rpc_resp = &res, | ||
726 | }; | ||
675 | mode_t mode = sattr->ia_mode; | 727 | mode_t mode = sattr->ia_mode; |
676 | int status; | 728 | int status; |
677 | 729 | ||
@@ -690,7 +742,7 @@ nfs3_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr, | |||
690 | 742 | ||
691 | nfs_fattr_init(&dir_attr); | 743 | nfs_fattr_init(&dir_attr); |
692 | nfs_fattr_init(&fattr); | 744 | nfs_fattr_init(&fattr); |
693 | status = rpc_call(NFS_CLIENT(dir), NFS3PROC_MKNOD, &arg, &res, 0); | 745 | status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); |
694 | nfs_post_op_update_inode(dir, &dir_attr); | 746 | nfs_post_op_update_inode(dir, &dir_attr); |
695 | if (status != 0) | 747 | if (status != 0) |
696 | goto out; | 748 | goto out; |
@@ -707,11 +759,16 @@ static int | |||
707 | nfs3_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, | 759 | nfs3_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, |
708 | struct nfs_fsstat *stat) | 760 | struct nfs_fsstat *stat) |
709 | { | 761 | { |
762 | struct rpc_message msg = { | ||
763 | .rpc_proc = &nfs3_procedures[NFS3PROC_FSSTAT], | ||
764 | .rpc_argp = fhandle, | ||
765 | .rpc_resp = stat, | ||
766 | }; | ||
710 | int status; | 767 | int status; |
711 | 768 | ||
712 | dprintk("NFS call fsstat\n"); | 769 | dprintk("NFS call fsstat\n"); |
713 | nfs_fattr_init(stat->fattr); | 770 | nfs_fattr_init(stat->fattr); |
714 | status = rpc_call(server->client, NFS3PROC_FSSTAT, fhandle, stat, 0); | 771 | status = rpc_call_sync(server->client, &msg, 0); |
715 | dprintk("NFS reply statfs: %d\n", status); | 772 | dprintk("NFS reply statfs: %d\n", status); |
716 | return status; | 773 | return status; |
717 | } | 774 | } |
@@ -720,11 +777,16 @@ static int | |||
720 | nfs3_proc_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, | 777 | nfs3_proc_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, |
721 | struct nfs_fsinfo *info) | 778 | struct nfs_fsinfo *info) |
722 | { | 779 | { |
780 | struct rpc_message msg = { | ||
781 | .rpc_proc = &nfs3_procedures[NFS3PROC_FSINFO], | ||
782 | .rpc_argp = fhandle, | ||
783 | .rpc_resp = info, | ||
784 | }; | ||
723 | int status; | 785 | int status; |
724 | 786 | ||
725 | dprintk("NFS call fsinfo\n"); | 787 | dprintk("NFS call fsinfo\n"); |
726 | nfs_fattr_init(info->fattr); | 788 | nfs_fattr_init(info->fattr); |
727 | status = rpc_call(server->client_sys, NFS3PROC_FSINFO, fhandle, info, 0); | 789 | status = rpc_call_sync(server->client_sys, &msg, 0); |
728 | dprintk("NFS reply fsinfo: %d\n", status); | 790 | dprintk("NFS reply fsinfo: %d\n", status); |
729 | return status; | 791 | return status; |
730 | } | 792 | } |
@@ -733,40 +795,34 @@ static int | |||
733 | nfs3_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle, | 795 | nfs3_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle, |
734 | struct nfs_pathconf *info) | 796 | struct nfs_pathconf *info) |
735 | { | 797 | { |
798 | struct rpc_message msg = { | ||
799 | .rpc_proc = &nfs3_procedures[NFS3PROC_PATHCONF], | ||
800 | .rpc_argp = fhandle, | ||
801 | .rpc_resp = info, | ||
802 | }; | ||
736 | int status; | 803 | int status; |
737 | 804 | ||
738 | dprintk("NFS call pathconf\n"); | 805 | dprintk("NFS call pathconf\n"); |
739 | nfs_fattr_init(info->fattr); | 806 | nfs_fattr_init(info->fattr); |
740 | status = rpc_call(server->client, NFS3PROC_PATHCONF, fhandle, info, 0); | 807 | status = rpc_call_sync(server->client, &msg, 0); |
741 | dprintk("NFS reply pathconf: %d\n", status); | 808 | dprintk("NFS reply pathconf: %d\n", status); |
742 | return status; | 809 | return status; |
743 | } | 810 | } |
744 | 811 | ||
745 | extern u32 *nfs3_decode_dirent(u32 *, struct nfs_entry *, int); | 812 | extern u32 *nfs3_decode_dirent(u32 *, struct nfs_entry *, int); |
746 | 813 | ||
747 | static void nfs3_read_done(struct rpc_task *task, void *calldata) | 814 | static int nfs3_read_done(struct rpc_task *task, struct nfs_read_data *data) |
748 | { | 815 | { |
749 | struct nfs_read_data *data = calldata; | 816 | if (nfs3_async_handle_jukebox(task, data->inode)) |
750 | 817 | return -EAGAIN; | |
751 | if (nfs3_async_handle_jukebox(task)) | ||
752 | return; | ||
753 | /* Call back common NFS readpage processing */ | 818 | /* Call back common NFS readpage processing */ |
754 | if (task->tk_status >= 0) | 819 | if (task->tk_status >= 0) |
755 | nfs_refresh_inode(data->inode, &data->fattr); | 820 | nfs_refresh_inode(data->inode, &data->fattr); |
756 | nfs_readpage_result(task, calldata); | 821 | return 0; |
757 | } | 822 | } |
758 | 823 | ||
759 | static const struct rpc_call_ops nfs3_read_ops = { | 824 | static void nfs3_proc_read_setup(struct nfs_read_data *data) |
760 | .rpc_call_done = nfs3_read_done, | ||
761 | .rpc_release = nfs_readdata_release, | ||
762 | }; | ||
763 | |||
764 | static void | ||
765 | nfs3_proc_read_setup(struct nfs_read_data *data) | ||
766 | { | 825 | { |
767 | struct rpc_task *task = &data->task; | ||
768 | struct inode *inode = data->inode; | ||
769 | int flags; | ||
770 | struct rpc_message msg = { | 826 | struct rpc_message msg = { |
771 | .rpc_proc = &nfs3_procedures[NFS3PROC_READ], | 827 | .rpc_proc = &nfs3_procedures[NFS3PROC_READ], |
772 | .rpc_argp = &data->args, | 828 | .rpc_argp = &data->args, |
@@ -774,37 +830,20 @@ nfs3_proc_read_setup(struct nfs_read_data *data) | |||
774 | .rpc_cred = data->cred, | 830 | .rpc_cred = data->cred, |
775 | }; | 831 | }; |
776 | 832 | ||
777 | /* N.B. Do we need to test? Never called for swapfile inode */ | 833 | rpc_call_setup(&data->task, &msg, 0); |
778 | flags = RPC_TASK_ASYNC | (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0); | ||
779 | |||
780 | /* Finalize the task. */ | ||
781 | rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs3_read_ops, data); | ||
782 | rpc_call_setup(task, &msg, 0); | ||
783 | } | 834 | } |
784 | 835 | ||
785 | static void nfs3_write_done(struct rpc_task *task, void *calldata) | 836 | static int nfs3_write_done(struct rpc_task *task, struct nfs_write_data *data) |
786 | { | 837 | { |
787 | struct nfs_write_data *data = calldata; | 838 | if (nfs3_async_handle_jukebox(task, data->inode)) |
788 | 839 | return -EAGAIN; | |
789 | if (nfs3_async_handle_jukebox(task)) | ||
790 | return; | ||
791 | if (task->tk_status >= 0) | 840 | if (task->tk_status >= 0) |
792 | nfs_post_op_update_inode(data->inode, data->res.fattr); | 841 | nfs_post_op_update_inode(data->inode, data->res.fattr); |
793 | nfs_writeback_done(task, calldata); | 842 | return 0; |
794 | } | 843 | } |
795 | 844 | ||
796 | static const struct rpc_call_ops nfs3_write_ops = { | 845 | static void nfs3_proc_write_setup(struct nfs_write_data *data, int how) |
797 | .rpc_call_done = nfs3_write_done, | ||
798 | .rpc_release = nfs_writedata_release, | ||
799 | }; | ||
800 | |||
801 | static void | ||
802 | nfs3_proc_write_setup(struct nfs_write_data *data, int how) | ||
803 | { | 846 | { |
804 | struct rpc_task *task = &data->task; | ||
805 | struct inode *inode = data->inode; | ||
806 | int stable; | ||
807 | int flags; | ||
808 | struct rpc_message msg = { | 847 | struct rpc_message msg = { |
809 | .rpc_proc = &nfs3_procedures[NFS3PROC_WRITE], | 848 | .rpc_proc = &nfs3_procedures[NFS3PROC_WRITE], |
810 | .rpc_argp = &data->args, | 849 | .rpc_argp = &data->args, |
@@ -812,45 +851,28 @@ nfs3_proc_write_setup(struct nfs_write_data *data, int how) | |||
812 | .rpc_cred = data->cred, | 851 | .rpc_cred = data->cred, |
813 | }; | 852 | }; |
814 | 853 | ||
854 | data->args.stable = NFS_UNSTABLE; | ||
815 | if (how & FLUSH_STABLE) { | 855 | if (how & FLUSH_STABLE) { |
816 | if (!NFS_I(inode)->ncommit) | 856 | data->args.stable = NFS_FILE_SYNC; |
817 | stable = NFS_FILE_SYNC; | 857 | if (NFS_I(data->inode)->ncommit) |
818 | else | 858 | data->args.stable = NFS_DATA_SYNC; |
819 | stable = NFS_DATA_SYNC; | 859 | } |
820 | } else | ||
821 | stable = NFS_UNSTABLE; | ||
822 | data->args.stable = stable; | ||
823 | |||
824 | /* Set the initial flags for the task. */ | ||
825 | flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; | ||
826 | 860 | ||
827 | /* Finalize the task. */ | 861 | /* Finalize the task. */ |
828 | rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs3_write_ops, data); | 862 | rpc_call_setup(&data->task, &msg, 0); |
829 | rpc_call_setup(task, &msg, 0); | ||
830 | } | 863 | } |
831 | 864 | ||
832 | static void nfs3_commit_done(struct rpc_task *task, void *calldata) | 865 | static int nfs3_commit_done(struct rpc_task *task, struct nfs_write_data *data) |
833 | { | 866 | { |
834 | struct nfs_write_data *data = calldata; | 867 | if (nfs3_async_handle_jukebox(task, data->inode)) |
835 | 868 | return -EAGAIN; | |
836 | if (nfs3_async_handle_jukebox(task)) | ||
837 | return; | ||
838 | if (task->tk_status >= 0) | 869 | if (task->tk_status >= 0) |
839 | nfs_post_op_update_inode(data->inode, data->res.fattr); | 870 | nfs_post_op_update_inode(data->inode, data->res.fattr); |
840 | nfs_commit_done(task, calldata); | 871 | return 0; |
841 | } | 872 | } |
842 | 873 | ||
843 | static const struct rpc_call_ops nfs3_commit_ops = { | 874 | static void nfs3_proc_commit_setup(struct nfs_write_data *data, int how) |
844 | .rpc_call_done = nfs3_commit_done, | ||
845 | .rpc_release = nfs_commit_release, | ||
846 | }; | ||
847 | |||
848 | static void | ||
849 | nfs3_proc_commit_setup(struct nfs_write_data *data, int how) | ||
850 | { | 875 | { |
851 | struct rpc_task *task = &data->task; | ||
852 | struct inode *inode = data->inode; | ||
853 | int flags; | ||
854 | struct rpc_message msg = { | 876 | struct rpc_message msg = { |
855 | .rpc_proc = &nfs3_procedures[NFS3PROC_COMMIT], | 877 | .rpc_proc = &nfs3_procedures[NFS3PROC_COMMIT], |
856 | .rpc_argp = &data->args, | 878 | .rpc_argp = &data->args, |
@@ -858,12 +880,7 @@ nfs3_proc_commit_setup(struct nfs_write_data *data, int how) | |||
858 | .rpc_cred = data->cred, | 880 | .rpc_cred = data->cred, |
859 | }; | 881 | }; |
860 | 882 | ||
861 | /* Set the initial flags for the task. */ | 883 | rpc_call_setup(&data->task, &msg, 0); |
862 | flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; | ||
863 | |||
864 | /* Finalize the task. */ | ||
865 | rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs3_commit_ops, data); | ||
866 | rpc_call_setup(task, &msg, 0); | ||
867 | } | 884 | } |
868 | 885 | ||
869 | static int | 886 | static int |
@@ -902,8 +919,11 @@ struct nfs_rpc_ops nfs_v3_clientops = { | |||
902 | .pathconf = nfs3_proc_pathconf, | 919 | .pathconf = nfs3_proc_pathconf, |
903 | .decode_dirent = nfs3_decode_dirent, | 920 | .decode_dirent = nfs3_decode_dirent, |
904 | .read_setup = nfs3_proc_read_setup, | 921 | .read_setup = nfs3_proc_read_setup, |
922 | .read_done = nfs3_read_done, | ||
905 | .write_setup = nfs3_proc_write_setup, | 923 | .write_setup = nfs3_proc_write_setup, |
924 | .write_done = nfs3_write_done, | ||
906 | .commit_setup = nfs3_proc_commit_setup, | 925 | .commit_setup = nfs3_proc_commit_setup, |
926 | .commit_done = nfs3_commit_done, | ||
907 | .file_open = nfs_open, | 927 | .file_open = nfs_open, |
908 | .file_release = nfs_release, | 928 | .file_release = nfs_release, |
909 | .lock = nfs3_proc_lock, | 929 | .lock = nfs3_proc_lock, |