diff options
Diffstat (limited to 'fs/nfs/nfs3proc.c')
-rw-r--r-- | fs/nfs/nfs3proc.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index 9d5d02f02515..c252fc983a7e 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
@@ -432,7 +432,6 @@ static int | |||
432 | nfs3_proc_rename(struct inode *old_dir, struct qstr *old_name, | 432 | nfs3_proc_rename(struct inode *old_dir, struct qstr *old_name, |
433 | struct inode *new_dir, struct qstr *new_name) | 433 | struct inode *new_dir, struct qstr *new_name) |
434 | { | 434 | { |
435 | struct nfs_fattr old_dir_attr, new_dir_attr; | ||
436 | struct nfs3_renameargs arg = { | 435 | struct nfs3_renameargs arg = { |
437 | .fromfh = NFS_FH(old_dir), | 436 | .fromfh = NFS_FH(old_dir), |
438 | .fromname = old_name->name, | 437 | .fromname = old_name->name, |
@@ -441,23 +440,27 @@ nfs3_proc_rename(struct inode *old_dir, struct qstr *old_name, | |||
441 | .toname = new_name->name, | 440 | .toname = new_name->name, |
442 | .tolen = new_name->len | 441 | .tolen = new_name->len |
443 | }; | 442 | }; |
444 | struct nfs3_renameres res = { | 443 | struct nfs3_renameres res; |
445 | .fromattr = &old_dir_attr, | ||
446 | .toattr = &new_dir_attr | ||
447 | }; | ||
448 | struct rpc_message msg = { | 444 | struct rpc_message msg = { |
449 | .rpc_proc = &nfs3_procedures[NFS3PROC_RENAME], | 445 | .rpc_proc = &nfs3_procedures[NFS3PROC_RENAME], |
450 | .rpc_argp = &arg, | 446 | .rpc_argp = &arg, |
451 | .rpc_resp = &res, | 447 | .rpc_resp = &res, |
452 | }; | 448 | }; |
453 | int status; | 449 | int status = -ENOMEM; |
454 | 450 | ||
455 | dprintk("NFS call rename %s -> %s\n", old_name->name, new_name->name); | 451 | dprintk("NFS call rename %s -> %s\n", old_name->name, new_name->name); |
456 | nfs_fattr_init(&old_dir_attr); | 452 | |
457 | nfs_fattr_init(&new_dir_attr); | 453 | res.fromattr = nfs_alloc_fattr(); |
454 | res.toattr = nfs_alloc_fattr(); | ||
455 | if (res.fromattr == NULL || res.toattr == NULL) | ||
456 | goto out; | ||
457 | |||
458 | status = rpc_call_sync(NFS_CLIENT(old_dir), &msg, 0); | 458 | status = rpc_call_sync(NFS_CLIENT(old_dir), &msg, 0); |
459 | nfs_post_op_update_inode(old_dir, &old_dir_attr); | 459 | nfs_post_op_update_inode(old_dir, res.fromattr); |
460 | nfs_post_op_update_inode(new_dir, &new_dir_attr); | 460 | nfs_post_op_update_inode(new_dir, res.toattr); |
461 | out: | ||
462 | nfs_free_fattr(res.toattr); | ||
463 | nfs_free_fattr(res.fromattr); | ||
461 | dprintk("NFS reply rename: %d\n", status); | 464 | dprintk("NFS reply rename: %d\n", status); |
462 | return status; | 465 | return status; |
463 | } | 466 | } |