diff options
Diffstat (limited to 'fs/nfs/proc.c')
| -rw-r--r-- | fs/nfs/proc.c | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index be23c3fb9260..a48a003242c0 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c | |||
| @@ -61,7 +61,7 @@ nfs_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, | |||
| 61 | int status; | 61 | int status; |
| 62 | 62 | ||
| 63 | dprintk("%s: call getattr\n", __FUNCTION__); | 63 | dprintk("%s: call getattr\n", __FUNCTION__); |
| 64 | fattr->valid = 0; | 64 | nfs_fattr_init(fattr); |
| 65 | status = rpc_call(server->client_sys, NFSPROC_GETATTR, fhandle, fattr, 0); | 65 | status = rpc_call(server->client_sys, NFSPROC_GETATTR, fhandle, fattr, 0); |
| 66 | dprintk("%s: reply getattr: %d\n", __FUNCTION__, status); | 66 | dprintk("%s: reply getattr: %d\n", __FUNCTION__, status); |
| 67 | if (status) | 67 | if (status) |
| @@ -93,7 +93,7 @@ nfs_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, | |||
| 93 | int status; | 93 | int status; |
| 94 | 94 | ||
| 95 | dprintk("NFS call getattr\n"); | 95 | dprintk("NFS call getattr\n"); |
| 96 | fattr->valid = 0; | 96 | nfs_fattr_init(fattr); |
| 97 | status = rpc_call(server->client, NFSPROC_GETATTR, | 97 | status = rpc_call(server->client, NFSPROC_GETATTR, |
| 98 | fhandle, fattr, 0); | 98 | fhandle, fattr, 0); |
| 99 | dprintk("NFS reply getattr: %d\n", status); | 99 | dprintk("NFS reply getattr: %d\n", status); |
| @@ -112,7 +112,7 @@ nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, | |||
| 112 | int status; | 112 | int status; |
| 113 | 113 | ||
| 114 | dprintk("NFS call setattr\n"); | 114 | dprintk("NFS call setattr\n"); |
| 115 | fattr->valid = 0; | 115 | nfs_fattr_init(fattr); |
| 116 | status = rpc_call(NFS_CLIENT(inode), NFSPROC_SETATTR, &arg, fattr, 0); | 116 | status = rpc_call(NFS_CLIENT(inode), NFSPROC_SETATTR, &arg, fattr, 0); |
| 117 | if (status == 0) | 117 | if (status == 0) |
| 118 | nfs_setattr_update_inode(inode, sattr); | 118 | nfs_setattr_update_inode(inode, sattr); |
| @@ -136,7 +136,7 @@ nfs_proc_lookup(struct inode *dir, struct qstr *name, | |||
| 136 | int status; | 136 | int status; |
| 137 | 137 | ||
| 138 | dprintk("NFS call lookup %s\n", name->name); | 138 | dprintk("NFS call lookup %s\n", name->name); |
| 139 | fattr->valid = 0; | 139 | nfs_fattr_init(fattr); |
| 140 | status = rpc_call(NFS_CLIENT(dir), NFSPROC_LOOKUP, &arg, &res, 0); | 140 | status = rpc_call(NFS_CLIENT(dir), NFSPROC_LOOKUP, &arg, &res, 0); |
| 141 | dprintk("NFS reply lookup: %d\n", status); | 141 | dprintk("NFS reply lookup: %d\n", status); |
| 142 | return status; | 142 | return status; |
| @@ -174,7 +174,7 @@ static int nfs_proc_read(struct nfs_read_data *rdata) | |||
| 174 | 174 | ||
| 175 | dprintk("NFS call read %d @ %Ld\n", rdata->args.count, | 175 | dprintk("NFS call read %d @ %Ld\n", rdata->args.count, |
| 176 | (long long) rdata->args.offset); | 176 | (long long) rdata->args.offset); |
| 177 | fattr->valid = 0; | 177 | nfs_fattr_init(fattr); |
| 178 | status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags); | 178 | status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags); |
| 179 | if (status >= 0) { | 179 | if (status >= 0) { |
| 180 | nfs_refresh_inode(inode, fattr); | 180 | nfs_refresh_inode(inode, fattr); |
| @@ -203,10 +203,10 @@ static int nfs_proc_write(struct nfs_write_data *wdata) | |||
| 203 | 203 | ||
| 204 | dprintk("NFS call write %d @ %Ld\n", wdata->args.count, | 204 | dprintk("NFS call write %d @ %Ld\n", wdata->args.count, |
| 205 | (long long) wdata->args.offset); | 205 | (long long) wdata->args.offset); |
| 206 | fattr->valid = 0; | 206 | nfs_fattr_init(fattr); |
| 207 | status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags); | 207 | status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags); |
| 208 | if (status >= 0) { | 208 | if (status >= 0) { |
| 209 | nfs_refresh_inode(inode, fattr); | 209 | nfs_post_op_update_inode(inode, fattr); |
| 210 | wdata->res.count = wdata->args.count; | 210 | wdata->res.count = wdata->args.count; |
| 211 | wdata->verf.committed = NFS_FILE_SYNC; | 211 | wdata->verf.committed = NFS_FILE_SYNC; |
| 212 | } | 212 | } |
| @@ -216,7 +216,7 @@ static int nfs_proc_write(struct nfs_write_data *wdata) | |||
| 216 | 216 | ||
| 217 | static int | 217 | static int |
| 218 | nfs_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, | 218 | nfs_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, |
| 219 | int flags) | 219 | int flags, struct nameidata *nd) |
| 220 | { | 220 | { |
| 221 | struct nfs_fh fhandle; | 221 | struct nfs_fh fhandle; |
| 222 | struct nfs_fattr fattr; | 222 | struct nfs_fattr fattr; |
| @@ -232,7 +232,7 @@ nfs_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, | |||
| 232 | }; | 232 | }; |
| 233 | int status; | 233 | int status; |
| 234 | 234 | ||
| 235 | fattr.valid = 0; | 235 | nfs_fattr_init(&fattr); |
| 236 | dprintk("NFS call create %s\n", dentry->d_name.name); | 236 | dprintk("NFS call create %s\n", dentry->d_name.name); |
| 237 | status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0); | 237 | status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0); |
| 238 | if (status == 0) | 238 | if (status == 0) |
| @@ -273,12 +273,13 @@ nfs_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr, | |||
| 273 | sattr->ia_size = new_encode_dev(rdev);/* get out your barf bag */ | 273 | sattr->ia_size = new_encode_dev(rdev);/* get out your barf bag */ |
| 274 | } | 274 | } |
| 275 | 275 | ||
| 276 | fattr.valid = 0; | 276 | nfs_fattr_init(&fattr); |
| 277 | status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0); | 277 | status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0); |
| 278 | nfs_mark_for_revalidate(dir); | ||
| 278 | 279 | ||
| 279 | if (status == -EINVAL && S_ISFIFO(mode)) { | 280 | if (status == -EINVAL && S_ISFIFO(mode)) { |
| 280 | sattr->ia_mode = mode; | 281 | sattr->ia_mode = mode; |
| 281 | fattr.valid = 0; | 282 | nfs_fattr_init(&fattr); |
| 282 | status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0); | 283 | status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0); |
| 283 | } | 284 | } |
| 284 | if (status == 0) | 285 | if (status == 0) |
| @@ -305,6 +306,7 @@ nfs_proc_remove(struct inode *dir, struct qstr *name) | |||
| 305 | 306 | ||
| 306 | dprintk("NFS call remove %s\n", name->name); | 307 | dprintk("NFS call remove %s\n", name->name); |
| 307 | status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); | 308 | status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); |
| 309 | nfs_mark_for_revalidate(dir); | ||
| 308 | 310 | ||
| 309 | dprintk("NFS reply remove: %d\n", status); | 311 | dprintk("NFS reply remove: %d\n", status); |
| 310 | return status; | 312 | return status; |
| @@ -331,8 +333,10 @@ nfs_proc_unlink_done(struct dentry *dir, struct rpc_task *task) | |||
| 331 | { | 333 | { |
| 332 | struct rpc_message *msg = &task->tk_msg; | 334 | struct rpc_message *msg = &task->tk_msg; |
| 333 | 335 | ||
| 334 | if (msg->rpc_argp) | 336 | if (msg->rpc_argp) { |
| 337 | nfs_mark_for_revalidate(dir->d_inode); | ||
| 335 | kfree(msg->rpc_argp); | 338 | kfree(msg->rpc_argp); |
| 339 | } | ||
| 336 | return 0; | 340 | return 0; |
| 337 | } | 341 | } |
| 338 | 342 | ||
| @@ -352,6 +356,8 @@ nfs_proc_rename(struct inode *old_dir, struct qstr *old_name, | |||
| 352 | 356 | ||
| 353 | dprintk("NFS call rename %s -> %s\n", old_name->name, new_name->name); | 357 | dprintk("NFS call rename %s -> %s\n", old_name->name, new_name->name); |
| 354 | status = rpc_call(NFS_CLIENT(old_dir), NFSPROC_RENAME, &arg, NULL, 0); | 358 | status = rpc_call(NFS_CLIENT(old_dir), NFSPROC_RENAME, &arg, NULL, 0); |
| 359 | nfs_mark_for_revalidate(old_dir); | ||
| 360 | nfs_mark_for_revalidate(new_dir); | ||
| 355 | dprintk("NFS reply rename: %d\n", status); | 361 | dprintk("NFS reply rename: %d\n", status); |
| 356 | return status; | 362 | return status; |
| 357 | } | 363 | } |
| @@ -369,6 +375,7 @@ nfs_proc_link(struct inode *inode, struct inode *dir, struct qstr *name) | |||
| 369 | 375 | ||
| 370 | dprintk("NFS call link %s\n", name->name); | 376 | dprintk("NFS call link %s\n", name->name); |
| 371 | status = rpc_call(NFS_CLIENT(inode), NFSPROC_LINK, &arg, NULL, 0); | 377 | status = rpc_call(NFS_CLIENT(inode), NFSPROC_LINK, &arg, NULL, 0); |
| 378 | nfs_mark_for_revalidate(dir); | ||
| 372 | dprintk("NFS reply link: %d\n", status); | 379 | dprintk("NFS reply link: %d\n", status); |
| 373 | return status; | 380 | return status; |
| 374 | } | 381 | } |
| @@ -391,9 +398,10 @@ nfs_proc_symlink(struct inode *dir, struct qstr *name, struct qstr *path, | |||
| 391 | if (path->len > NFS2_MAXPATHLEN) | 398 | if (path->len > NFS2_MAXPATHLEN) |
| 392 | return -ENAMETOOLONG; | 399 | return -ENAMETOOLONG; |
| 393 | dprintk("NFS call symlink %s -> %s\n", name->name, path->name); | 400 | dprintk("NFS call symlink %s -> %s\n", name->name, path->name); |
| 394 | fattr->valid = 0; | 401 | nfs_fattr_init(fattr); |
| 395 | fhandle->size = 0; | 402 | fhandle->size = 0; |
| 396 | status = rpc_call(NFS_CLIENT(dir), NFSPROC_SYMLINK, &arg, NULL, 0); | 403 | status = rpc_call(NFS_CLIENT(dir), NFSPROC_SYMLINK, &arg, NULL, 0); |
| 404 | nfs_mark_for_revalidate(dir); | ||
| 397 | dprintk("NFS reply symlink: %d\n", status); | 405 | dprintk("NFS reply symlink: %d\n", status); |
| 398 | return status; | 406 | return status; |
| 399 | } | 407 | } |
| @@ -416,8 +424,9 @@ nfs_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr) | |||
| 416 | int status; | 424 | int status; |
| 417 | 425 | ||
| 418 | dprintk("NFS call mkdir %s\n", dentry->d_name.name); | 426 | dprintk("NFS call mkdir %s\n", dentry->d_name.name); |
| 419 | fattr.valid = 0; | 427 | nfs_fattr_init(&fattr); |
| 420 | status = rpc_call(NFS_CLIENT(dir), NFSPROC_MKDIR, &arg, &res, 0); | 428 | status = rpc_call(NFS_CLIENT(dir), NFSPROC_MKDIR, &arg, &res, 0); |
| 429 | nfs_mark_for_revalidate(dir); | ||
| 421 | if (status == 0) | 430 | if (status == 0) |
| 422 | status = nfs_instantiate(dentry, &fhandle, &fattr); | 431 | status = nfs_instantiate(dentry, &fhandle, &fattr); |
| 423 | dprintk("NFS reply mkdir: %d\n", status); | 432 | dprintk("NFS reply mkdir: %d\n", status); |
| @@ -436,6 +445,7 @@ nfs_proc_rmdir(struct inode *dir, struct qstr *name) | |||
| 436 | 445 | ||
| 437 | dprintk("NFS call rmdir %s\n", name->name); | 446 | dprintk("NFS call rmdir %s\n", name->name); |
| 438 | status = rpc_call(NFS_CLIENT(dir), NFSPROC_RMDIR, &arg, NULL, 0); | 447 | status = rpc_call(NFS_CLIENT(dir), NFSPROC_RMDIR, &arg, NULL, 0); |
| 448 | nfs_mark_for_revalidate(dir); | ||
| 439 | dprintk("NFS reply rmdir: %d\n", status); | 449 | dprintk("NFS reply rmdir: %d\n", status); |
| 440 | return status; | 450 | return status; |
| 441 | } | 451 | } |
| @@ -484,7 +494,7 @@ nfs_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, | |||
| 484 | int status; | 494 | int status; |
| 485 | 495 | ||
| 486 | dprintk("NFS call statfs\n"); | 496 | dprintk("NFS call statfs\n"); |
| 487 | stat->fattr->valid = 0; | 497 | nfs_fattr_init(stat->fattr); |
| 488 | status = rpc_call(server->client, NFSPROC_STATFS, fhandle, &fsinfo, 0); | 498 | status = rpc_call(server->client, NFSPROC_STATFS, fhandle, &fsinfo, 0); |
| 489 | dprintk("NFS reply statfs: %d\n", status); | 499 | dprintk("NFS reply statfs: %d\n", status); |
| 490 | if (status) | 500 | if (status) |
| @@ -507,7 +517,7 @@ nfs_proc_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, | |||
| 507 | int status; | 517 | int status; |
| 508 | 518 | ||
| 509 | dprintk("NFS call fsinfo\n"); | 519 | dprintk("NFS call fsinfo\n"); |
| 510 | info->fattr->valid = 0; | 520 | nfs_fattr_init(info->fattr); |
| 511 | status = rpc_call(server->client, NFSPROC_STATFS, fhandle, &fsinfo, 0); | 521 | status = rpc_call(server->client, NFSPROC_STATFS, fhandle, &fsinfo, 0); |
| 512 | dprintk("NFS reply fsinfo: %d\n", status); | 522 | dprintk("NFS reply fsinfo: %d\n", status); |
| 513 | if (status) | 523 | if (status) |
| @@ -579,7 +589,7 @@ nfs_write_done(struct rpc_task *task) | |||
| 579 | struct nfs_write_data *data = (struct nfs_write_data *) task->tk_calldata; | 589 | struct nfs_write_data *data = (struct nfs_write_data *) task->tk_calldata; |
| 580 | 590 | ||
| 581 | if (task->tk_status >= 0) | 591 | if (task->tk_status >= 0) |
| 582 | nfs_refresh_inode(data->inode, data->res.fattr); | 592 | nfs_post_op_update_inode(data->inode, data->res.fattr); |
| 583 | nfs_writeback_done(task); | 593 | nfs_writeback_done(task); |
| 584 | } | 594 | } |
| 585 | 595 | ||
