aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2005-10-27 22:12:43 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2005-10-27 22:12:43 -0400
commit6caf2c8276d371679a798058e8fdf49f5ff831a3 (patch)
treeff53620d5879644df543dcce2ce86db863dad21c
parent91ba2eeec5e8e86e054937eb3bf5aec5b22b1830 (diff)
NFSv4: Add post-op attributes to nfs4_proc_rename()
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/nfs/nfs4proc.c15
-rw-r--r--fs/nfs/nfs4xdr.c29
-rw-r--r--include/linux/nfs_xdr.h4
3 files changed, 41 insertions, 7 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 04995e39e867..f96bc12c0fa0 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1685,13 +1685,20 @@ static int nfs4_proc_unlink_done(struct dentry *dir, struct rpc_task *task)
1685static int _nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name, 1685static int _nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name,
1686 struct inode *new_dir, struct qstr *new_name) 1686 struct inode *new_dir, struct qstr *new_name)
1687{ 1687{
1688 struct nfs_server *server = NFS_SERVER(old_dir);
1688 struct nfs4_rename_arg arg = { 1689 struct nfs4_rename_arg arg = {
1689 .old_dir = NFS_FH(old_dir), 1690 .old_dir = NFS_FH(old_dir),
1690 .new_dir = NFS_FH(new_dir), 1691 .new_dir = NFS_FH(new_dir),
1691 .old_name = old_name, 1692 .old_name = old_name,
1692 .new_name = new_name, 1693 .new_name = new_name,
1694 .bitmask = server->attr_bitmask,
1695 };
1696 struct nfs_fattr old_fattr, new_fattr;
1697 struct nfs4_rename_res res = {
1698 .server = server,
1699 .old_fattr = &old_fattr,
1700 .new_fattr = &new_fattr,
1693 }; 1701 };
1694 struct nfs4_rename_res res = { };
1695 struct rpc_message msg = { 1702 struct rpc_message msg = {
1696 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENAME], 1703 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENAME],
1697 .rpc_argp = &arg, 1704 .rpc_argp = &arg,
@@ -1699,11 +1706,15 @@ static int _nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name,
1699 }; 1706 };
1700 int status; 1707 int status;
1701 1708
1702 status = rpc_call_sync(NFS_CLIENT(old_dir), &msg, 0); 1709 nfs_fattr_init(res.old_fattr);
1710 nfs_fattr_init(res.new_fattr);
1711 status = rpc_call_sync(server->client, &msg, 0);
1703 1712
1704 if (!status) { 1713 if (!status) {
1705 update_changeattr(old_dir, &res.old_cinfo); 1714 update_changeattr(old_dir, &res.old_cinfo);
1715 nfs_post_op_update_inode(old_dir, res.old_fattr);
1706 update_changeattr(new_dir, &res.new_cinfo); 1716 update_changeattr(new_dir, &res.new_cinfo);
1717 nfs_post_op_update_inode(new_dir, res.new_fattr);
1707 } 1718 }
1708 return status; 1719 return status;
1709} 1720}
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index f624b693ce21..2a07755bd347 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -314,12 +314,18 @@ static int nfs_stat_to_errno(int);
314 encode_putfh_maxsz + \ 314 encode_putfh_maxsz + \
315 encode_savefh_maxsz + \ 315 encode_savefh_maxsz + \
316 encode_putfh_maxsz + \ 316 encode_putfh_maxsz + \
317 encode_rename_maxsz) 317 encode_rename_maxsz + \
318 encode_getattr_maxsz + \
319 encode_restorefh_maxsz + \
320 encode_getattr_maxsz)
318#define NFS4_dec_rename_sz (compound_decode_hdr_maxsz + \ 321#define NFS4_dec_rename_sz (compound_decode_hdr_maxsz + \
319 decode_putfh_maxsz + \ 322 decode_putfh_maxsz + \
320 decode_savefh_maxsz + \ 323 decode_savefh_maxsz + \
321 decode_putfh_maxsz + \ 324 decode_putfh_maxsz + \
322 decode_rename_maxsz) 325 decode_rename_maxsz + \
326 decode_getattr_maxsz + \
327 decode_restorefh_maxsz + \
328 decode_getattr_maxsz)
323#define NFS4_enc_link_sz (compound_encode_hdr_maxsz + \ 329#define NFS4_enc_link_sz (compound_encode_hdr_maxsz + \
324 encode_putfh_maxsz + \ 330 encode_putfh_maxsz + \
325 encode_savefh_maxsz + \ 331 encode_savefh_maxsz + \
@@ -1339,7 +1345,7 @@ static int nfs4_xdr_enc_rename(struct rpc_rqst *req, uint32_t *p, const struct n
1339{ 1345{
1340 struct xdr_stream xdr; 1346 struct xdr_stream xdr;
1341 struct compound_hdr hdr = { 1347 struct compound_hdr hdr = {
1342 .nops = 4, 1348 .nops = 7,
1343 }; 1349 };
1344 int status; 1350 int status;
1345 1351
@@ -1351,7 +1357,13 @@ static int nfs4_xdr_enc_rename(struct rpc_rqst *req, uint32_t *p, const struct n
1351 goto out; 1357 goto out;
1352 if ((status = encode_putfh(&xdr, args->new_dir)) != 0) 1358 if ((status = encode_putfh(&xdr, args->new_dir)) != 0)
1353 goto out; 1359 goto out;
1354 status = encode_rename(&xdr, args->old_name, args->new_name); 1360 if ((status = encode_rename(&xdr, args->old_name, args->new_name)) != 0)
1361 goto out;
1362 if ((status = encode_getfattr(&xdr, args->bitmask)) != 0)
1363 goto out;
1364 if ((status = encode_restorefh(&xdr)) != 0)
1365 goto out;
1366 status = encode_getfattr(&xdr, args->bitmask);
1355out: 1367out:
1356 return status; 1368 return status;
1357} 1369}
@@ -3533,7 +3545,14 @@ static int nfs4_xdr_dec_rename(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_
3533 goto out; 3545 goto out;
3534 if ((status = decode_putfh(&xdr)) != 0) 3546 if ((status = decode_putfh(&xdr)) != 0)
3535 goto out; 3547 goto out;
3536 status = decode_rename(&xdr, &res->old_cinfo, &res->new_cinfo); 3548 if ((status = decode_rename(&xdr, &res->old_cinfo, &res->new_cinfo)) != 0)
3549 goto out;
3550 /* Current FH is target directory */
3551 if (decode_getfattr(&xdr, res->new_fattr, res->server) != 0)
3552 goto out;
3553 if ((status = decode_restorefh(&xdr)) != 0)
3554 goto out;
3555 decode_getfattr(&xdr, res->old_fattr, res->server);
3537out: 3556out:
3538 return status; 3557 return status;
3539} 3558}
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 89238b799cfd..6f0804280824 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -630,11 +630,15 @@ struct nfs4_rename_arg {
630 const struct nfs_fh * new_dir; 630 const struct nfs_fh * new_dir;
631 const struct qstr * old_name; 631 const struct qstr * old_name;
632 const struct qstr * new_name; 632 const struct qstr * new_name;
633 const u32 * bitmask;
633}; 634};
634 635
635struct nfs4_rename_res { 636struct nfs4_rename_res {
637 const struct nfs_server * server;
636 struct nfs4_change_info old_cinfo; 638 struct nfs4_change_info old_cinfo;
639 struct nfs_fattr * old_fattr;
637 struct nfs4_change_info new_cinfo; 640 struct nfs4_change_info new_cinfo;
641 struct nfs_fattr * new_fattr;
638}; 642};
639 643
640struct nfs4_setclientid { 644struct nfs4_setclientid {