aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs3proc.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2010-04-16 16:22:49 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-05-14 15:09:25 -0400
commit136f2627c932da5835e67e464e191d8c43c3f3fd (patch)
tree5f6aff24fe7163a260c553f3d4899c4ef51abbf7 /fs/nfs/nfs3proc.c
parentaa49b4cf7dbf45438563f0ff6a2d23a68b70a7b9 (diff)
NFS: Reduce the stack footprint of nfs_link()
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs3proc.c')
-rw-r--r--fs/nfs/nfs3proc.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 1c5bfb3d6f08..982a81bb7257 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -468,30 +468,32 @@ out:
468static int 468static int
469nfs3_proc_link(struct inode *inode, struct inode *dir, struct qstr *name) 469nfs3_proc_link(struct inode *inode, struct inode *dir, struct qstr *name)
470{ 470{
471 struct nfs_fattr dir_attr, fattr;
472 struct nfs3_linkargs arg = { 471 struct nfs3_linkargs arg = {
473 .fromfh = NFS_FH(inode), 472 .fromfh = NFS_FH(inode),
474 .tofh = NFS_FH(dir), 473 .tofh = NFS_FH(dir),
475 .toname = name->name, 474 .toname = name->name,
476 .tolen = name->len 475 .tolen = name->len
477 }; 476 };
478 struct nfs3_linkres res = { 477 struct nfs3_linkres res;
479 .dir_attr = &dir_attr,
480 .fattr = &fattr
481 };
482 struct rpc_message msg = { 478 struct rpc_message msg = {
483 .rpc_proc = &nfs3_procedures[NFS3PROC_LINK], 479 .rpc_proc = &nfs3_procedures[NFS3PROC_LINK],
484 .rpc_argp = &arg, 480 .rpc_argp = &arg,
485 .rpc_resp = &res, 481 .rpc_resp = &res,
486 }; 482 };
487 int status; 483 int status = -ENOMEM;
488 484
489 dprintk("NFS call link %s\n", name->name); 485 dprintk("NFS call link %s\n", name->name);
490 nfs_fattr_init(&dir_attr); 486 res.fattr = nfs_alloc_fattr();
491 nfs_fattr_init(&fattr); 487 res.dir_attr = nfs_alloc_fattr();
488 if (res.fattr == NULL || res.dir_attr == NULL)
489 goto out;
490
492 status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); 491 status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
493 nfs_post_op_update_inode(dir, &dir_attr); 492 nfs_post_op_update_inode(dir, res.dir_attr);
494 nfs_post_op_update_inode(inode, &fattr); 493 nfs_post_op_update_inode(inode, res.fattr);
494out:
495 nfs_free_fattr(res.dir_attr);
496 nfs_free_fattr(res.fattr);
495 dprintk("NFS reply link: %d\n", status); 497 dprintk("NFS reply link: %d\n", status);
496 return status; 498 return status;
497} 499}