diff options
Diffstat (limited to 'fs/nfs/proc.c')
| -rw-r--r-- | fs/nfs/proc.c | 156 |
1 files changed, 95 insertions, 61 deletions
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index f5150d71c03d..9dd85cac2df0 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 | |||
| 90 | nfs_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, | 97 | nfs_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; |
| @@ -550,10 +613,8 @@ nfs_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle, | |||
| 550 | 613 | ||
| 551 | extern u32 * nfs_decode_dirent(u32 *, struct nfs_entry *, int); | 614 | extern u32 * nfs_decode_dirent(u32 *, struct nfs_entry *, int); |
| 552 | 615 | ||
| 553 | static void nfs_read_done(struct rpc_task *task, void *calldata) | 616 | static int nfs_read_done(struct rpc_task *task, struct nfs_read_data *data) |
| 554 | { | 617 | { |
| 555 | struct nfs_read_data *data = calldata; | ||
| 556 | |||
| 557 | if (task->tk_status >= 0) { | 618 | if (task->tk_status >= 0) { |
| 558 | nfs_refresh_inode(data->inode, data->res.fattr); | 619 | nfs_refresh_inode(data->inode, data->res.fattr); |
| 559 | /* Emulate the eof flag, which isn't normally needed in NFSv2 | 620 | /* Emulate the eof flag, which isn't normally needed in NFSv2 |
| @@ -562,20 +623,11 @@ static void nfs_read_done(struct rpc_task *task, void *calldata) | |||
| 562 | if (data->args.offset + data->args.count >= data->res.fattr->size) | 623 | if (data->args.offset + data->args.count >= data->res.fattr->size) |
| 563 | data->res.eof = 1; | 624 | data->res.eof = 1; |
| 564 | } | 625 | } |
| 565 | nfs_readpage_result(task, calldata); | 626 | return 0; |
| 566 | } | 627 | } |
| 567 | 628 | ||
| 568 | static const struct rpc_call_ops nfs_read_ops = { | 629 | static void nfs_proc_read_setup(struct nfs_read_data *data) |
| 569 | .rpc_call_done = nfs_read_done, | ||
| 570 | .rpc_release = nfs_readdata_release, | ||
| 571 | }; | ||
| 572 | |||
| 573 | static void | ||
| 574 | nfs_proc_read_setup(struct nfs_read_data *data) | ||
| 575 | { | 630 | { |
| 576 | struct rpc_task *task = &data->task; | ||
| 577 | struct inode *inode = data->inode; | ||
| 578 | int flags; | ||
| 579 | struct rpc_message msg = { | 631 | struct rpc_message msg = { |
| 580 | .rpc_proc = &nfs_procedures[NFSPROC_READ], | 632 | .rpc_proc = &nfs_procedures[NFSPROC_READ], |
| 581 | .rpc_argp = &data->args, | 633 | .rpc_argp = &data->args, |
| @@ -583,34 +635,18 @@ nfs_proc_read_setup(struct nfs_read_data *data) | |||
| 583 | .rpc_cred = data->cred, | 635 | .rpc_cred = data->cred, |
| 584 | }; | 636 | }; |
| 585 | 637 | ||
| 586 | /* N.B. Do we need to test? Never called for swapfile inode */ | 638 | rpc_call_setup(&data->task, &msg, 0); |
| 587 | flags = RPC_TASK_ASYNC | (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0); | ||
| 588 | |||
| 589 | /* Finalize the task. */ | ||
| 590 | rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs_read_ops, data); | ||
| 591 | rpc_call_setup(task, &msg, 0); | ||
| 592 | } | 639 | } |
| 593 | 640 | ||
| 594 | static void nfs_write_done(struct rpc_task *task, void *calldata) | 641 | static int nfs_write_done(struct rpc_task *task, struct nfs_write_data *data) |
| 595 | { | 642 | { |
| 596 | struct nfs_write_data *data = calldata; | ||
| 597 | |||
| 598 | if (task->tk_status >= 0) | 643 | if (task->tk_status >= 0) |
| 599 | nfs_post_op_update_inode(data->inode, data->res.fattr); | 644 | nfs_post_op_update_inode(data->inode, data->res.fattr); |
| 600 | nfs_writeback_done(task, calldata); | 645 | return 0; |
| 601 | } | 646 | } |
| 602 | 647 | ||
| 603 | static const struct rpc_call_ops nfs_write_ops = { | 648 | static void nfs_proc_write_setup(struct nfs_write_data *data, int how) |
| 604 | .rpc_call_done = nfs_write_done, | ||
| 605 | .rpc_release = nfs_writedata_release, | ||
| 606 | }; | ||
| 607 | |||
| 608 | static void | ||
| 609 | nfs_proc_write_setup(struct nfs_write_data *data, int how) | ||
| 610 | { | 649 | { |
| 611 | struct rpc_task *task = &data->task; | ||
| 612 | struct inode *inode = data->inode; | ||
| 613 | int flags; | ||
| 614 | struct rpc_message msg = { | 650 | struct rpc_message msg = { |
| 615 | .rpc_proc = &nfs_procedures[NFSPROC_WRITE], | 651 | .rpc_proc = &nfs_procedures[NFSPROC_WRITE], |
| 616 | .rpc_argp = &data->args, | 652 | .rpc_argp = &data->args, |
| @@ -621,12 +657,8 @@ nfs_proc_write_setup(struct nfs_write_data *data, int how) | |||
| 621 | /* Note: NFSv2 ignores @stable and always uses NFS_FILE_SYNC */ | 657 | /* Note: NFSv2 ignores @stable and always uses NFS_FILE_SYNC */ |
| 622 | data->args.stable = NFS_FILE_SYNC; | 658 | data->args.stable = NFS_FILE_SYNC; |
| 623 | 659 | ||
| 624 | /* Set the initial flags for the task. */ | ||
| 625 | flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; | ||
| 626 | |||
| 627 | /* Finalize the task. */ | 660 | /* Finalize the task. */ |
| 628 | rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs_write_ops, data); | 661 | rpc_call_setup(&data->task, &msg, 0); |
| 629 | rpc_call_setup(task, &msg, 0); | ||
| 630 | } | 662 | } |
| 631 | 663 | ||
| 632 | static void | 664 | static void |
| @@ -672,7 +704,9 @@ struct nfs_rpc_ops nfs_v2_clientops = { | |||
| 672 | .pathconf = nfs_proc_pathconf, | 704 | .pathconf = nfs_proc_pathconf, |
| 673 | .decode_dirent = nfs_decode_dirent, | 705 | .decode_dirent = nfs_decode_dirent, |
| 674 | .read_setup = nfs_proc_read_setup, | 706 | .read_setup = nfs_proc_read_setup, |
| 707 | .read_done = nfs_read_done, | ||
| 675 | .write_setup = nfs_proc_write_setup, | 708 | .write_setup = nfs_proc_write_setup, |
| 709 | .write_done = nfs_write_done, | ||
| 676 | .commit_setup = nfs_proc_commit_setup, | 710 | .commit_setup = nfs_proc_commit_setup, |
| 677 | .file_open = nfs_open, | 711 | .file_open = nfs_open, |
| 678 | .file_release = nfs_release, | 712 | .file_release = nfs_release, |
