aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorChuck Lever <cel@netapp.com>2006-03-20 13:44:23 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-20 13:44:23 -0500
commitdead28da8e3fb32601d38fb32b7021122e0a3d21 (patch)
treea1a23e27e08345c86ed0d9812f848470b615eb34 /fs/nfs
parentcc0175c1dc1de8f6af0eb0631dcc5b999a6fcc42 (diff)
SUNRPC: eliminate rpc_call()
Clean-up: replace rpc_call() helper with direct call to rpc_call_sync. This makes NFSv2 and NFSv3 synchronous calls more computationally efficient, and reduces stack consumption in functions that used to invoke rpc_call more than once. Test plan: Compile kernel with CONFIG_NFS enabled. Connectathon on NFS version 2, version 3, and version 4 mount points. Signed-off-by: Chuck Lever <cel@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/mount_clnt.c13
-rw-r--r--fs/nfs/nfs3acl.c16
-rw-r--r--fs/nfs/nfs3proc.c140
-rw-r--r--fs/nfs/proc.c107
4 files changed, 209 insertions, 67 deletions
diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c
index 4a1340358223..c44d87bdddb3 100644
--- a/fs/nfs/mount_clnt.c
+++ b/fs/nfs/mount_clnt.c
@@ -49,9 +49,12 @@ nfsroot_mount(struct sockaddr_in *addr, char *path, struct nfs_fh *fh,
49 struct mnt_fhstatus result = { 49 struct mnt_fhstatus result = {
50 .fh = fh 50 .fh = fh
51 }; 51 };
52 struct rpc_message msg = {
53 .rpc_argp = path,
54 .rpc_resp = &result,
55 };
52 char hostname[32]; 56 char hostname[32];
53 int status; 57 int status;
54 int call;
55 58
56 dprintk("NFS: nfs_mount(%08x:%s)\n", 59 dprintk("NFS: nfs_mount(%08x:%s)\n",
57 (unsigned)ntohl(addr->sin_addr.s_addr), path); 60 (unsigned)ntohl(addr->sin_addr.s_addr), path);
@@ -61,8 +64,12 @@ nfsroot_mount(struct sockaddr_in *addr, char *path, struct nfs_fh *fh,
61 if (IS_ERR(mnt_clnt)) 64 if (IS_ERR(mnt_clnt))
62 return PTR_ERR(mnt_clnt); 65 return PTR_ERR(mnt_clnt);
63 66
64 call = (version == NFS_MNT3_VERSION) ? MOUNTPROC3_MNT : MNTPROC_MNT; 67 if (version == NFS_MNT3_VERSION)
65 status = rpc_call(mnt_clnt, call, path, &result, 0); 68 msg.rpc_proc = &mnt_clnt->cl_procinfo[MOUNTPROC3_MNT];
69 else
70 msg.rpc_proc = &mnt_clnt->cl_procinfo[MNTPROC_MNT];
71
72 status = rpc_call_sync(mnt_clnt, &msg, 0);
66 return status < 0? status : (result.status? -EACCES : 0); 73 return status < 0? status : (result.status? -EACCES : 0);
67} 74}
68 75
diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c
index 6a5bbc0ae941..33287879bd23 100644
--- a/fs/nfs/nfs3acl.c
+++ b/fs/nfs/nfs3acl.c
@@ -190,6 +190,10 @@ struct posix_acl *nfs3_proc_getacl(struct inode *inode, int type)
190 struct nfs3_getaclres res = { 190 struct nfs3_getaclres res = {
191 .fattr = &fattr, 191 .fattr = &fattr,
192 }; 192 };
193 struct rpc_message msg = {
194 .rpc_argp = &args,
195 .rpc_resp = &res,
196 };
193 struct posix_acl *acl; 197 struct posix_acl *acl;
194 int status, count; 198 int status, count;
195 199
@@ -218,8 +222,8 @@ struct posix_acl *nfs3_proc_getacl(struct inode *inode, int type)
218 return NULL; 222 return NULL;
219 223
220 dprintk("NFS call getacl\n"); 224 dprintk("NFS call getacl\n");
221 status = rpc_call(server->client_acl, ACLPROC3_GETACL, 225 msg.rpc_proc = &server->client_acl->cl_procinfo[ACLPROC3_GETACL];
222 &args, &res, 0); 226 status = rpc_call_sync(server->client_acl, &msg, 0);
223 dprintk("NFS reply getacl: %d\n", status); 227 dprintk("NFS reply getacl: %d\n", status);
224 228
225 /* pages may have been allocated at the xdr layer. */ 229 /* pages may have been allocated at the xdr layer. */
@@ -286,6 +290,10 @@ static int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
286 .acl_access = acl, 290 .acl_access = acl,
287 .pages = pages, 291 .pages = pages,
288 }; 292 };
293 struct rpc_message msg = {
294 .rpc_argp = &args,
295 .rpc_resp = &fattr,
296 };
289 int status, count; 297 int status, count;
290 298
291 status = -EOPNOTSUPP; 299 status = -EOPNOTSUPP;
@@ -306,8 +314,8 @@ static int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
306 314
307 dprintk("NFS call setacl\n"); 315 dprintk("NFS call setacl\n");
308 nfs_begin_data_update(inode); 316 nfs_begin_data_update(inode);
309 status = rpc_call(server->client_acl, ACLPROC3_SETACL, 317 msg.rpc_proc = &server->client_acl->cl_procinfo[ACLPROC3_SETACL];
310 &args, &fattr, 0); 318 status = rpc_call_sync(server->client_acl, &msg, 0);
311 spin_lock(&inode->i_lock); 319 spin_lock(&inode->i_lock);
312 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ACCESS; 320 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ACCESS;
313 spin_unlock(&inode->i_lock); 321 spin_unlock(&inode->i_lock);
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 7204ba5b2bf8..740f8b1ab04d 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -43,21 +43,7 @@ nfs3_rpc_wrapper(struct rpc_clnt *clnt, struct rpc_message *msg, int flags)
43 return res; 43 return res;
44} 44}
45 45
46static inline int 46#define rpc_call_sync(clnt, msg, flags) nfs3_rpc_wrapper(clnt, msg, flags)
47nfs3_rpc_call_wrapper(struct rpc_clnt *clnt, u32 proc, void *argp, void *resp, int flags)
48{
49 struct rpc_message msg = {
50 .rpc_proc = &clnt->cl_procinfo[proc],
51 .rpc_argp = argp,
52 .rpc_resp = resp,
53 };
54 return nfs3_rpc_wrapper(clnt, &msg, flags);
55}
56
57#define rpc_call(clnt, proc, argp, resp, flags) \
58 nfs3_rpc_call_wrapper(clnt, proc, argp, resp, flags)
59#define rpc_call_sync(clnt, msg, flags) \
60 nfs3_rpc_wrapper(clnt, msg, flags)
61 47
62static int 48static int
63nfs3_async_handle_jukebox(struct rpc_task *task, struct inode *inode) 49nfs3_async_handle_jukebox(struct rpc_task *task, struct inode *inode)
@@ -75,14 +61,21 @@ static int
75do_proc_get_root(struct rpc_clnt *client, struct nfs_fh *fhandle, 61do_proc_get_root(struct rpc_clnt *client, struct nfs_fh *fhandle,
76 struct nfs_fsinfo *info) 62 struct nfs_fsinfo *info)
77{ 63{
64 struct rpc_message msg = {
65 .rpc_proc = &nfs3_procedures[NFS3PROC_FSINFO],
66 .rpc_argp = fhandle,
67 .rpc_resp = info,
68 };
78 int status; 69 int status;
79 70
80 dprintk("%s: call fsinfo\n", __FUNCTION__); 71 dprintk("%s: call fsinfo\n", __FUNCTION__);
81 nfs_fattr_init(info->fattr); 72 nfs_fattr_init(info->fattr);
82 status = rpc_call(client, NFS3PROC_FSINFO, fhandle, info, 0); 73 status = rpc_call_sync(client, &msg, 0);
83 dprintk("%s: reply fsinfo: %d\n", __FUNCTION__, status); 74 dprintk("%s: reply fsinfo: %d\n", __FUNCTION__, status);
84 if (!(info->fattr->valid & NFS_ATTR_FATTR)) { 75 if (!(info->fattr->valid & NFS_ATTR_FATTR)) {
85 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);
86 dprintk("%s: reply getattr: %d\n", __FUNCTION__, status); 79 dprintk("%s: reply getattr: %d\n", __FUNCTION__, status);
87 } 80 }
88 return status; 81 return status;
@@ -110,12 +103,16 @@ static int
110nfs3_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, 103nfs3_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
111 struct nfs_fattr *fattr) 104 struct nfs_fattr *fattr)
112{ 105{
106 struct rpc_message msg = {
107 .rpc_proc = &nfs3_procedures[NFS3PROC_GETATTR],
108 .rpc_argp = fhandle,
109 .rpc_resp = fattr,
110 };
113 int status; 111 int status;
114 112
115 dprintk("NFS call getattr\n"); 113 dprintk("NFS call getattr\n");
116 nfs_fattr_init(fattr); 114 nfs_fattr_init(fattr);
117 status = rpc_call(server->client, NFS3PROC_GETATTR, 115 status = rpc_call_sync(server->client, &msg, 0);
118 fhandle, fattr, 0);
119 dprintk("NFS reply getattr: %d\n", status); 116 dprintk("NFS reply getattr: %d\n", status);
120 return status; 117 return status;
121} 118}
@@ -129,11 +126,16 @@ nfs3_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
129 .fh = NFS_FH(inode), 126 .fh = NFS_FH(inode),
130 .sattr = sattr, 127 .sattr = sattr,
131 }; 128 };
129 struct rpc_message msg = {
130 .rpc_proc = &nfs3_procedures[NFS3PROC_SETATTR],
131 .rpc_argp = &arg,
132 .rpc_resp = fattr,
133 };
132 int status; 134 int status;
133 135
134 dprintk("NFS call setattr\n"); 136 dprintk("NFS call setattr\n");
135 nfs_fattr_init(fattr); 137 nfs_fattr_init(fattr);
136 status = rpc_call(NFS_CLIENT(inode), NFS3PROC_SETATTR, &arg, fattr, 0); 138 status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
137 if (status == 0) 139 if (status == 0)
138 nfs_setattr_update_inode(inode, sattr); 140 nfs_setattr_update_inode(inode, sattr);
139 dprintk("NFS reply setattr: %d\n", status); 141 dprintk("NFS reply setattr: %d\n", status);
@@ -155,15 +157,23 @@ nfs3_proc_lookup(struct inode *dir, struct qstr *name,
155 .fh = fhandle, 157 .fh = fhandle,
156 .fattr = fattr 158 .fattr = fattr
157 }; 159 };
160 struct rpc_message msg = {
161 .rpc_proc = &nfs3_procedures[NFS3PROC_LOOKUP],
162 .rpc_argp = &arg,
163 .rpc_resp = &res,
164 };
158 int status; 165 int status;
159 166
160 dprintk("NFS call lookup %s\n", name->name); 167 dprintk("NFS call lookup %s\n", name->name);
161 nfs_fattr_init(&dir_attr); 168 nfs_fattr_init(&dir_attr);
162 nfs_fattr_init(fattr); 169 nfs_fattr_init(fattr);
163 status = rpc_call(NFS_CLIENT(dir), NFS3PROC_LOOKUP, &arg, &res, 0); 170 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
164 if (status >= 0 && !(fattr->valid & NFS_ATTR_FATTR)) 171 if (status >= 0 && !(fattr->valid & NFS_ATTR_FATTR)) {
165 status = rpc_call(NFS_CLIENT(dir), NFS3PROC_GETATTR, 172 msg.rpc_proc = &nfs3_procedures[NFS3PROC_GETATTR];
166 fhandle, fattr, 0); 173 msg.rpc_argp = fhandle;
174 msg.rpc_resp = fattr;
175 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
176 }
167 dprintk("NFS reply lookup: %d\n", status); 177 dprintk("NFS reply lookup: %d\n", status);
168 if (status >= 0) 178 if (status >= 0)
169 status = nfs_refresh_inode(dir, &dir_attr); 179 status = nfs_refresh_inode(dir, &dir_attr);
@@ -183,7 +193,7 @@ static int nfs3_proc_access(struct inode *inode, struct nfs_access_entry *entry)
183 .rpc_proc = &nfs3_procedures[NFS3PROC_ACCESS], 193 .rpc_proc = &nfs3_procedures[NFS3PROC_ACCESS],
184 .rpc_argp = &arg, 194 .rpc_argp = &arg,
185 .rpc_resp = &res, 195 .rpc_resp = &res,
186 .rpc_cred = entry->cred 196 .rpc_cred = entry->cred,
187 }; 197 };
188 int mode = entry->mask; 198 int mode = entry->mask;
189 int status; 199 int status;
@@ -229,12 +239,16 @@ static int nfs3_proc_readlink(struct inode *inode, struct page *page,
229 .pglen = pglen, 239 .pglen = pglen,
230 .pages = &page 240 .pages = &page
231 }; 241 };
242 struct rpc_message msg = {
243 .rpc_proc = &nfs3_procedures[NFS3PROC_READLINK],
244 .rpc_argp = &args,
245 .rpc_resp = &fattr,
246 };
232 int status; 247 int status;
233 248
234 dprintk("NFS call readlink\n"); 249 dprintk("NFS call readlink\n");
235 nfs_fattr_init(&fattr); 250 nfs_fattr_init(&fattr);
236 status = rpc_call(NFS_CLIENT(inode), NFS3PROC_READLINK, 251 status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
237 &args, &fattr, 0);
238 nfs_refresh_inode(inode, &fattr); 252 nfs_refresh_inode(inode, &fattr);
239 dprintk("NFS reply readlink: %d\n", status); 253 dprintk("NFS reply readlink: %d\n", status);
240 return status; 254 return status;
@@ -330,6 +344,11 @@ nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
330 .fh = &fhandle, 344 .fh = &fhandle,
331 .fattr = &fattr 345 .fattr = &fattr
332 }; 346 };
347 struct rpc_message msg = {
348 .rpc_proc = &nfs3_procedures[NFS3PROC_CREATE],
349 .rpc_argp = &arg,
350 .rpc_resp = &res,
351 };
333 mode_t mode = sattr->ia_mode; 352 mode_t mode = sattr->ia_mode;
334 int status; 353 int status;
335 354
@@ -346,8 +365,8 @@ nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
346again: 365again:
347 nfs_fattr_init(&dir_attr); 366 nfs_fattr_init(&dir_attr);
348 nfs_fattr_init(&fattr); 367 nfs_fattr_init(&fattr);
349 status = rpc_call(NFS_CLIENT(dir), NFS3PROC_CREATE, &arg, &res, 0); 368 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
350 nfs_post_op_update_inode(dir, &dir_attr); 369 nfs_refresh_inode(dir, &dir_attr);
351 370
352 /* If the server doesn't support the exclusive creation semantics, 371 /* If the server doesn't support the exclusive creation semantics,
353 * try again with simple 'guarded' mode. */ 372 * try again with simple 'guarded' mode. */
@@ -477,12 +496,17 @@ nfs3_proc_rename(struct inode *old_dir, struct qstr *old_name,
477 .fromattr = &old_dir_attr, 496 .fromattr = &old_dir_attr,
478 .toattr = &new_dir_attr 497 .toattr = &new_dir_attr
479 }; 498 };
499 struct rpc_message msg = {
500 .rpc_proc = &nfs3_procedures[NFS3PROC_RENAME],
501 .rpc_argp = &arg,
502 .rpc_resp = &res,
503 };
480 int status; 504 int status;
481 505
482 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);
483 nfs_fattr_init(&old_dir_attr); 507 nfs_fattr_init(&old_dir_attr);
484 nfs_fattr_init(&new_dir_attr); 508 nfs_fattr_init(&new_dir_attr);
485 status = rpc_call(NFS_CLIENT(old_dir), NFS3PROC_RENAME, &arg, &res, 0); 509 status = rpc_call_sync(NFS_CLIENT(old_dir), &msg, 0);
486 nfs_post_op_update_inode(old_dir, &old_dir_attr); 510 nfs_post_op_update_inode(old_dir, &old_dir_attr);
487 nfs_post_op_update_inode(new_dir, &new_dir_attr); 511 nfs_post_op_update_inode(new_dir, &new_dir_attr);
488 dprintk("NFS reply rename: %d\n", status); 512 dprintk("NFS reply rename: %d\n", status);
@@ -503,12 +527,17 @@ nfs3_proc_link(struct inode *inode, struct inode *dir, struct qstr *name)
503 .dir_attr = &dir_attr, 527 .dir_attr = &dir_attr,
504 .fattr = &fattr 528 .fattr = &fattr
505 }; 529 };
530 struct rpc_message msg = {
531 .rpc_proc = &nfs3_procedures[NFS3PROC_LINK],
532 .rpc_argp = &arg,
533 .rpc_resp = &res,
534 };
506 int status; 535 int status;
507 536
508 dprintk("NFS call link %s\n", name->name); 537 dprintk("NFS call link %s\n", name->name);
509 nfs_fattr_init(&dir_attr); 538 nfs_fattr_init(&dir_attr);
510 nfs_fattr_init(&fattr); 539 nfs_fattr_init(&fattr);
511 status = rpc_call(NFS_CLIENT(inode), NFS3PROC_LINK, &arg, &res, 0); 540 status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
512 nfs_post_op_update_inode(dir, &dir_attr); 541 nfs_post_op_update_inode(dir, &dir_attr);
513 nfs_post_op_update_inode(inode, &fattr); 542 nfs_post_op_update_inode(inode, &fattr);
514 dprintk("NFS reply link: %d\n", status); 543 dprintk("NFS reply link: %d\n", status);
@@ -534,6 +563,11 @@ nfs3_proc_symlink(struct inode *dir, struct qstr *name, struct qstr *path,
534 .fh = fhandle, 563 .fh = fhandle,
535 .fattr = fattr 564 .fattr = fattr
536 }; 565 };
566 struct rpc_message msg = {
567 .rpc_proc = &nfs3_procedures[NFS3PROC_SYMLINK],
568 .rpc_argp = &arg,
569 .rpc_resp = &res,
570 };
537 int status; 571 int status;
538 572
539 if (path->len > NFS3_MAXPATHLEN) 573 if (path->len > NFS3_MAXPATHLEN)
@@ -541,7 +575,7 @@ nfs3_proc_symlink(struct inode *dir, struct qstr *name, struct qstr *path,
541 dprintk("NFS call symlink %s -> %s\n", name->name, path->name); 575 dprintk("NFS call symlink %s -> %s\n", name->name, path->name);
542 nfs_fattr_init(&dir_attr); 576 nfs_fattr_init(&dir_attr);
543 nfs_fattr_init(fattr); 577 nfs_fattr_init(fattr);
544 status = rpc_call(NFS_CLIENT(dir), NFS3PROC_SYMLINK, &arg, &res, 0); 578 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
545 nfs_post_op_update_inode(dir, &dir_attr); 579 nfs_post_op_update_inode(dir, &dir_attr);
546 dprintk("NFS reply symlink: %d\n", status); 580 dprintk("NFS reply symlink: %d\n", status);
547 return status; 581 return status;
@@ -563,6 +597,11 @@ nfs3_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr)
563 .fh = &fhandle, 597 .fh = &fhandle,
564 .fattr = &fattr 598 .fattr = &fattr
565 }; 599 };
600 struct rpc_message msg = {
601 .rpc_proc = &nfs3_procedures[NFS3PROC_MKDIR],
602 .rpc_argp = &arg,
603 .rpc_resp = &res,
604 };
566 int mode = sattr->ia_mode; 605 int mode = sattr->ia_mode;
567 int status; 606 int status;
568 607
@@ -572,7 +611,7 @@ nfs3_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr)
572 611
573 nfs_fattr_init(&dir_attr); 612 nfs_fattr_init(&dir_attr);
574 nfs_fattr_init(&fattr); 613 nfs_fattr_init(&fattr);
575 status = rpc_call(NFS_CLIENT(dir), NFS3PROC_MKDIR, &arg, &res, 0); 614 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
576 nfs_post_op_update_inode(dir, &dir_attr); 615 nfs_post_op_update_inode(dir, &dir_attr);
577 if (status != 0) 616 if (status != 0)
578 goto out; 617 goto out;
@@ -594,11 +633,16 @@ nfs3_proc_rmdir(struct inode *dir, struct qstr *name)
594 .name = name->name, 633 .name = name->name,
595 .len = name->len 634 .len = name->len
596 }; 635 };
636 struct rpc_message msg = {
637 .rpc_proc = &nfs3_procedures[NFS3PROC_RMDIR],
638 .rpc_argp = &arg,
639 .rpc_resp = &dir_attr,
640 };
597 int status; 641 int status;
598 642
599 dprintk("NFS call rmdir %s\n", name->name); 643 dprintk("NFS call rmdir %s\n", name->name);
600 nfs_fattr_init(&dir_attr); 644 nfs_fattr_init(&dir_attr);
601 status = rpc_call(NFS_CLIENT(dir), NFS3PROC_RMDIR, &arg, &dir_attr, 0); 645 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
602 nfs_post_op_update_inode(dir, &dir_attr); 646 nfs_post_op_update_inode(dir, &dir_attr);
603 dprintk("NFS reply rmdir: %d\n", status); 647 dprintk("NFS reply rmdir: %d\n", status);
604 return status; 648 return status;
@@ -675,6 +719,11 @@ nfs3_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
675 .fh = &fh, 719 .fh = &fh,
676 .fattr = &fattr 720 .fattr = &fattr
677 }; 721 };
722 struct rpc_message msg = {
723 .rpc_proc = &nfs3_procedures[NFS3PROC_MKNOD],
724 .rpc_argp = &arg,
725 .rpc_resp = &res,
726 };
678 mode_t mode = sattr->ia_mode; 727 mode_t mode = sattr->ia_mode;
679 int status; 728 int status;
680 729
@@ -693,7 +742,7 @@ nfs3_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
693 742
694 nfs_fattr_init(&dir_attr); 743 nfs_fattr_init(&dir_attr);
695 nfs_fattr_init(&fattr); 744 nfs_fattr_init(&fattr);
696 status = rpc_call(NFS_CLIENT(dir), NFS3PROC_MKNOD, &arg, &res, 0); 745 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
697 nfs_post_op_update_inode(dir, &dir_attr); 746 nfs_post_op_update_inode(dir, &dir_attr);
698 if (status != 0) 747 if (status != 0)
699 goto out; 748 goto out;
@@ -710,11 +759,16 @@ static int
710nfs3_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, 759nfs3_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle,
711 struct nfs_fsstat *stat) 760 struct nfs_fsstat *stat)
712{ 761{
762 struct rpc_message msg = {
763 .rpc_proc = &nfs3_procedures[NFS3PROC_FSSTAT],
764 .rpc_argp = fhandle,
765 .rpc_resp = stat,
766 };
713 int status; 767 int status;
714 768
715 dprintk("NFS call fsstat\n"); 769 dprintk("NFS call fsstat\n");
716 nfs_fattr_init(stat->fattr); 770 nfs_fattr_init(stat->fattr);
717 status = rpc_call(server->client, NFS3PROC_FSSTAT, fhandle, stat, 0); 771 status = rpc_call_sync(server->client, &msg, 0);
718 dprintk("NFS reply statfs: %d\n", status); 772 dprintk("NFS reply statfs: %d\n", status);
719 return status; 773 return status;
720} 774}
@@ -723,11 +777,16 @@ static int
723nfs3_proc_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, 777nfs3_proc_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle,
724 struct nfs_fsinfo *info) 778 struct nfs_fsinfo *info)
725{ 779{
780 struct rpc_message msg = {
781 .rpc_proc = &nfs3_procedures[NFS3PROC_FSINFO],
782 .rpc_argp = fhandle,
783 .rpc_resp = info,
784 };
726 int status; 785 int status;
727 786
728 dprintk("NFS call fsinfo\n"); 787 dprintk("NFS call fsinfo\n");
729 nfs_fattr_init(info->fattr); 788 nfs_fattr_init(info->fattr);
730 status = rpc_call(server->client_sys, NFS3PROC_FSINFO, fhandle, info, 0); 789 status = rpc_call_sync(server->client_sys, &msg, 0);
731 dprintk("NFS reply fsinfo: %d\n", status); 790 dprintk("NFS reply fsinfo: %d\n", status);
732 return status; 791 return status;
733} 792}
@@ -736,11 +795,16 @@ static int
736nfs3_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle, 795nfs3_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
737 struct nfs_pathconf *info) 796 struct nfs_pathconf *info)
738{ 797{
798 struct rpc_message msg = {
799 .rpc_proc = &nfs3_procedures[NFS3PROC_PATHCONF],
800 .rpc_argp = fhandle,
801 .rpc_resp = info,
802 };
739 int status; 803 int status;
740 804
741 dprintk("NFS call pathconf\n"); 805 dprintk("NFS call pathconf\n");
742 nfs_fattr_init(info->fattr); 806 nfs_fattr_init(info->fattr);
743 status = rpc_call(server->client, NFS3PROC_PATHCONF, fhandle, info, 0); 807 status = rpc_call_sync(server->client, &msg, 0);
744 dprintk("NFS reply pathconf: %d\n", status); 808 dprintk("NFS reply pathconf: %d\n", status);
745 return status; 809 return status;
746} 810}
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
index f5150d71c03d..2b051ab8bea8 100644
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -58,16 +58,23 @@ nfs_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
58{ 58{
59 struct nfs_fattr *fattr = info->fattr; 59 struct nfs_fattr *fattr = info->fattr;
60 struct nfs2_fsstat fsinfo; 60 struct nfs2_fsstat fsinfo;
61 struct rpc_message msg = {
62 .rpc_proc = &nfs_procedures[NFSPROC_GETATTR],
63 .rpc_argp = fhandle,
64 .rpc_resp = fattr,
65 };
61 int status; 66 int status;
62 67
63 dprintk("%s: call getattr\n", __FUNCTION__); 68 dprintk("%s: call getattr\n", __FUNCTION__);
64 nfs_fattr_init(fattr); 69 nfs_fattr_init(fattr);
65 status = rpc_call(server->client_sys, NFSPROC_GETATTR, fhandle, fattr, 0); 70 status = rpc_call_sync(server->client_sys, &msg, 0);
66 dprintk("%s: reply getattr: %d\n", __FUNCTION__, status); 71 dprintk("%s: reply getattr: %d\n", __FUNCTION__, status);
67 if (status) 72 if (status)
68 return status; 73 return status;
69 dprintk("%s: call statfs\n", __FUNCTION__); 74 dprintk("%s: call statfs\n", __FUNCTION__);
70 status = rpc_call(server->client_sys, NFSPROC_STATFS, fhandle, &fsinfo, 0); 75 msg.rpc_proc = &nfs_procedures[NFSPROC_STATFS];
76 msg.rpc_resp = &fsinfo;
77 status = rpc_call_sync(server->client_sys, &msg, 0);
71 dprintk("%s: reply statfs: %d\n", __FUNCTION__, status); 78 dprintk("%s: reply statfs: %d\n", __FUNCTION__, status);
72 if (status) 79 if (status)
73 return status; 80 return status;
@@ -90,12 +97,16 @@ static int
90nfs_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, 97nfs_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
91 struct nfs_fattr *fattr) 98 struct nfs_fattr *fattr)
92{ 99{
100 struct rpc_message msg = {
101 .rpc_proc = &nfs_procedures[NFSPROC_GETATTR],
102 .rpc_argp = fhandle,
103 .rpc_resp = fattr,
104 };
93 int status; 105 int status;
94 106
95 dprintk("NFS call getattr\n"); 107 dprintk("NFS call getattr\n");
96 nfs_fattr_init(fattr); 108 nfs_fattr_init(fattr);
97 status = rpc_call(server->client, NFSPROC_GETATTR, 109 status = rpc_call_sync(server->client, &msg, 0);
98 fhandle, fattr, 0);
99 dprintk("NFS reply getattr: %d\n", status); 110 dprintk("NFS reply getattr: %d\n", status);
100 return status; 111 return status;
101} 112}
@@ -109,6 +120,11 @@ nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
109 .fh = NFS_FH(inode), 120 .fh = NFS_FH(inode),
110 .sattr = sattr 121 .sattr = sattr
111 }; 122 };
123 struct rpc_message msg = {
124 .rpc_proc = &nfs_procedures[NFSPROC_SETATTR],
125 .rpc_argp = &arg,
126 .rpc_resp = fattr,
127 };
112 int status; 128 int status;
113 129
114 /* Mask out the non-modebit related stuff from attr->ia_mode */ 130 /* Mask out the non-modebit related stuff from attr->ia_mode */
@@ -116,7 +132,7 @@ nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
116 132
117 dprintk("NFS call setattr\n"); 133 dprintk("NFS call setattr\n");
118 nfs_fattr_init(fattr); 134 nfs_fattr_init(fattr);
119 status = rpc_call(NFS_CLIENT(inode), NFSPROC_SETATTR, &arg, fattr, 0); 135 status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
120 if (status == 0) 136 if (status == 0)
121 nfs_setattr_update_inode(inode, sattr); 137 nfs_setattr_update_inode(inode, sattr);
122 dprintk("NFS reply setattr: %d\n", status); 138 dprintk("NFS reply setattr: %d\n", status);
@@ -136,11 +152,16 @@ nfs_proc_lookup(struct inode *dir, struct qstr *name,
136 .fh = fhandle, 152 .fh = fhandle,
137 .fattr = fattr 153 .fattr = fattr
138 }; 154 };
155 struct rpc_message msg = {
156 .rpc_proc = &nfs_procedures[NFSPROC_LOOKUP],
157 .rpc_argp = &arg,
158 .rpc_resp = &res,
159 };
139 int status; 160 int status;
140 161
141 dprintk("NFS call lookup %s\n", name->name); 162 dprintk("NFS call lookup %s\n", name->name);
142 nfs_fattr_init(fattr); 163 nfs_fattr_init(fattr);
143 status = rpc_call(NFS_CLIENT(dir), NFSPROC_LOOKUP, &arg, &res, 0); 164 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
144 dprintk("NFS reply lookup: %d\n", status); 165 dprintk("NFS reply lookup: %d\n", status);
145 return status; 166 return status;
146} 167}
@@ -154,10 +175,14 @@ static int nfs_proc_readlink(struct inode *inode, struct page *page,
154 .pglen = pglen, 175 .pglen = pglen,
155 .pages = &page 176 .pages = &page
156 }; 177 };
178 struct rpc_message msg = {
179 .rpc_proc = &nfs_procedures[NFSPROC_READLINK],
180 .rpc_argp = &args,
181 };
157 int status; 182 int status;
158 183
159 dprintk("NFS call readlink\n"); 184 dprintk("NFS call readlink\n");
160 status = rpc_call(NFS_CLIENT(inode), NFSPROC_READLINK, &args, NULL, 0); 185 status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
161 dprintk("NFS reply readlink: %d\n", status); 186 dprintk("NFS reply readlink: %d\n", status);
162 return status; 187 return status;
163} 188}
@@ -233,11 +258,16 @@ nfs_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
233 .fh = &fhandle, 258 .fh = &fhandle,
234 .fattr = &fattr 259 .fattr = &fattr
235 }; 260 };
261 struct rpc_message msg = {
262 .rpc_proc = &nfs_procedures[NFSPROC_CREATE],
263 .rpc_argp = &arg,
264 .rpc_resp = &res,
265 };
236 int status; 266 int status;
237 267
238 nfs_fattr_init(&fattr); 268 nfs_fattr_init(&fattr);
239 dprintk("NFS call create %s\n", dentry->d_name.name); 269 dprintk("NFS call create %s\n", dentry->d_name.name);
240 status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0); 270 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
241 if (status == 0) 271 if (status == 0)
242 status = nfs_instantiate(dentry, &fhandle, &fattr); 272 status = nfs_instantiate(dentry, &fhandle, &fattr);
243 dprintk("NFS reply create: %d\n", status); 273 dprintk("NFS reply create: %d\n", status);
@@ -263,6 +293,11 @@ nfs_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
263 .fh = &fhandle, 293 .fh = &fhandle,
264 .fattr = &fattr 294 .fattr = &fattr
265 }; 295 };
296 struct rpc_message msg = {
297 .rpc_proc = &nfs_procedures[NFSPROC_CREATE],
298 .rpc_argp = &arg,
299 .rpc_resp = &res,
300 };
266 int status, mode; 301 int status, mode;
267 302
268 dprintk("NFS call mknod %s\n", dentry->d_name.name); 303 dprintk("NFS call mknod %s\n", dentry->d_name.name);
@@ -277,13 +312,13 @@ nfs_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
277 } 312 }
278 313
279 nfs_fattr_init(&fattr); 314 nfs_fattr_init(&fattr);
280 status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0); 315 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
281 nfs_mark_for_revalidate(dir); 316 nfs_mark_for_revalidate(dir);
282 317
283 if (status == -EINVAL && S_ISFIFO(mode)) { 318 if (status == -EINVAL && S_ISFIFO(mode)) {
284 sattr->ia_mode = mode; 319 sattr->ia_mode = mode;
285 nfs_fattr_init(&fattr); 320 nfs_fattr_init(&fattr);
286 status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0); 321 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
287 } 322 }
288 if (status == 0) 323 if (status == 0)
289 status = nfs_instantiate(dentry, &fhandle, &fattr); 324 status = nfs_instantiate(dentry, &fhandle, &fattr);
@@ -302,8 +337,6 @@ nfs_proc_remove(struct inode *dir, struct qstr *name)
302 struct rpc_message msg = { 337 struct rpc_message msg = {
303 .rpc_proc = &nfs_procedures[NFSPROC_REMOVE], 338 .rpc_proc = &nfs_procedures[NFSPROC_REMOVE],
304 .rpc_argp = &arg, 339 .rpc_argp = &arg,
305 .rpc_resp = NULL,
306 .rpc_cred = NULL
307 }; 340 };
308 int status; 341 int status;
309 342
@@ -355,10 +388,14 @@ nfs_proc_rename(struct inode *old_dir, struct qstr *old_name,
355 .toname = new_name->name, 388 .toname = new_name->name,
356 .tolen = new_name->len 389 .tolen = new_name->len
357 }; 390 };
391 struct rpc_message msg = {
392 .rpc_proc = &nfs_procedures[NFSPROC_RENAME],
393 .rpc_argp = &arg,
394 };
358 int status; 395 int status;
359 396
360 dprintk("NFS call rename %s -> %s\n", old_name->name, new_name->name); 397 dprintk("NFS call rename %s -> %s\n", old_name->name, new_name->name);
361 status = rpc_call(NFS_CLIENT(old_dir), NFSPROC_RENAME, &arg, NULL, 0); 398 status = rpc_call_sync(NFS_CLIENT(old_dir), &msg, 0);
362 nfs_mark_for_revalidate(old_dir); 399 nfs_mark_for_revalidate(old_dir);
363 nfs_mark_for_revalidate(new_dir); 400 nfs_mark_for_revalidate(new_dir);
364 dprintk("NFS reply rename: %d\n", status); 401 dprintk("NFS reply rename: %d\n", status);
@@ -374,10 +411,14 @@ nfs_proc_link(struct inode *inode, struct inode *dir, struct qstr *name)
374 .toname = name->name, 411 .toname = name->name,
375 .tolen = name->len 412 .tolen = name->len
376 }; 413 };
414 struct rpc_message msg = {
415 .rpc_proc = &nfs_procedures[NFSPROC_LINK],
416 .rpc_argp = &arg,
417 };
377 int status; 418 int status;
378 419
379 dprintk("NFS call link %s\n", name->name); 420 dprintk("NFS call link %s\n", name->name);
380 status = rpc_call(NFS_CLIENT(inode), NFSPROC_LINK, &arg, NULL, 0); 421 status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
381 nfs_mark_for_revalidate(inode); 422 nfs_mark_for_revalidate(inode);
382 nfs_mark_for_revalidate(dir); 423 nfs_mark_for_revalidate(dir);
383 dprintk("NFS reply link: %d\n", status); 424 dprintk("NFS reply link: %d\n", status);
@@ -397,6 +438,10 @@ nfs_proc_symlink(struct inode *dir, struct qstr *name, struct qstr *path,
397 .tolen = path->len, 438 .tolen = path->len,
398 .sattr = sattr 439 .sattr = sattr
399 }; 440 };
441 struct rpc_message msg = {
442 .rpc_proc = &nfs_procedures[NFSPROC_SYMLINK],
443 .rpc_argp = &arg,
444 };
400 int status; 445 int status;
401 446
402 if (path->len > NFS2_MAXPATHLEN) 447 if (path->len > NFS2_MAXPATHLEN)
@@ -404,7 +449,7 @@ nfs_proc_symlink(struct inode *dir, struct qstr *name, struct qstr *path,
404 dprintk("NFS call symlink %s -> %s\n", name->name, path->name); 449 dprintk("NFS call symlink %s -> %s\n", name->name, path->name);
405 nfs_fattr_init(fattr); 450 nfs_fattr_init(fattr);
406 fhandle->size = 0; 451 fhandle->size = 0;
407 status = rpc_call(NFS_CLIENT(dir), NFSPROC_SYMLINK, &arg, NULL, 0); 452 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
408 nfs_mark_for_revalidate(dir); 453 nfs_mark_for_revalidate(dir);
409 dprintk("NFS reply symlink: %d\n", status); 454 dprintk("NFS reply symlink: %d\n", status);
410 return status; 455 return status;
@@ -425,11 +470,16 @@ nfs_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr)
425 .fh = &fhandle, 470 .fh = &fhandle,
426 .fattr = &fattr 471 .fattr = &fattr
427 }; 472 };
473 struct rpc_message msg = {
474 .rpc_proc = &nfs_procedures[NFSPROC_MKDIR],
475 .rpc_argp = &arg,
476 .rpc_resp = &res,
477 };
428 int status; 478 int status;
429 479
430 dprintk("NFS call mkdir %s\n", dentry->d_name.name); 480 dprintk("NFS call mkdir %s\n", dentry->d_name.name);
431 nfs_fattr_init(&fattr); 481 nfs_fattr_init(&fattr);
432 status = rpc_call(NFS_CLIENT(dir), NFSPROC_MKDIR, &arg, &res, 0); 482 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
433 nfs_mark_for_revalidate(dir); 483 nfs_mark_for_revalidate(dir);
434 if (status == 0) 484 if (status == 0)
435 status = nfs_instantiate(dentry, &fhandle, &fattr); 485 status = nfs_instantiate(dentry, &fhandle, &fattr);
@@ -445,10 +495,14 @@ nfs_proc_rmdir(struct inode *dir, struct qstr *name)
445 .name = name->name, 495 .name = name->name,
446 .len = name->len 496 .len = name->len
447 }; 497 };
498 struct rpc_message msg = {
499 .rpc_proc = &nfs_procedures[NFSPROC_RMDIR],
500 .rpc_argp = &arg,
501 };
448 int status; 502 int status;
449 503
450 dprintk("NFS call rmdir %s\n", name->name); 504 dprintk("NFS call rmdir %s\n", name->name);
451 status = rpc_call(NFS_CLIENT(dir), NFSPROC_RMDIR, &arg, NULL, 0); 505 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
452 nfs_mark_for_revalidate(dir); 506 nfs_mark_for_revalidate(dir);
453 dprintk("NFS reply rmdir: %d\n", status); 507 dprintk("NFS reply rmdir: %d\n", status);
454 return status; 508 return status;
@@ -470,13 +524,12 @@ nfs_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
470 .fh = NFS_FH(dir), 524 .fh = NFS_FH(dir),
471 .cookie = cookie, 525 .cookie = cookie,
472 .count = count, 526 .count = count,
473 .pages = &page 527 .pages = &page,
474 }; 528 };
475 struct rpc_message msg = { 529 struct rpc_message msg = {
476 .rpc_proc = &nfs_procedures[NFSPROC_READDIR], 530 .rpc_proc = &nfs_procedures[NFSPROC_READDIR],
477 .rpc_argp = &arg, 531 .rpc_argp = &arg,
478 .rpc_resp = NULL, 532 .rpc_cred = cred,
479 .rpc_cred = cred
480 }; 533 };
481 int status; 534 int status;
482 535
@@ -495,11 +548,16 @@ nfs_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle,
495 struct nfs_fsstat *stat) 548 struct nfs_fsstat *stat)
496{ 549{
497 struct nfs2_fsstat fsinfo; 550 struct nfs2_fsstat fsinfo;
551 struct rpc_message msg = {
552 .rpc_proc = &nfs_procedures[NFSPROC_STATFS],
553 .rpc_argp = fhandle,
554 .rpc_resp = &fsinfo,
555 };
498 int status; 556 int status;
499 557
500 dprintk("NFS call statfs\n"); 558 dprintk("NFS call statfs\n");
501 nfs_fattr_init(stat->fattr); 559 nfs_fattr_init(stat->fattr);
502 status = rpc_call(server->client, NFSPROC_STATFS, fhandle, &fsinfo, 0); 560 status = rpc_call_sync(server->client, &msg, 0);
503 dprintk("NFS reply statfs: %d\n", status); 561 dprintk("NFS reply statfs: %d\n", status);
504 if (status) 562 if (status)
505 goto out; 563 goto out;
@@ -518,11 +576,16 @@ nfs_proc_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle,
518 struct nfs_fsinfo *info) 576 struct nfs_fsinfo *info)
519{ 577{
520 struct nfs2_fsstat fsinfo; 578 struct nfs2_fsstat fsinfo;
579 struct rpc_message msg = {
580 .rpc_proc = &nfs_procedures[NFSPROC_STATFS],
581 .rpc_argp = fhandle,
582 .rpc_resp = &fsinfo,
583 };
521 int status; 584 int status;
522 585
523 dprintk("NFS call fsinfo\n"); 586 dprintk("NFS call fsinfo\n");
524 nfs_fattr_init(info->fattr); 587 nfs_fattr_init(info->fattr);
525 status = rpc_call(server->client, NFSPROC_STATFS, fhandle, &fsinfo, 0); 588 status = rpc_call_sync(server->client, &msg, 0);
526 dprintk("NFS reply fsinfo: %d\n", status); 589 dprintk("NFS reply fsinfo: %d\n", status);
527 if (status) 590 if (status)
528 goto out; 591 goto out;