aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2010-04-16 16:22:50 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-05-14 15:09:26 -0400
commitd346890bea062d697e24fb4e34591428021ad011 (patch)
tree9d644b18500a146c51c6e0d2f68bdb636f67fa11 /fs/nfs
parent3b14d6542d7efbec614277d1cd7d6f5b5a2be9ca (diff)
NFS: Reduce stack footprint of nfs_proc_remove()
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/nfs3proc.c13
-rw-r--r--fs/nfs/nfs3xdr.c2
-rw-r--r--fs/nfs/nfs4proc.c13
-rw-r--r--fs/nfs/nfs4xdr.c2
-rw-r--r--fs/nfs/unlink.c4
5 files changed, 23 insertions, 11 deletions
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 088dceb513b8..80378d1283cb 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -406,12 +406,17 @@ nfs3_proc_remove(struct inode *dir, struct qstr *name)
406 .rpc_argp = &arg, 406 .rpc_argp = &arg,
407 .rpc_resp = &res, 407 .rpc_resp = &res,
408 }; 408 };
409 int status; 409 int status = -ENOMEM;
410 410
411 dprintk("NFS call remove %s\n", name->name); 411 dprintk("NFS call remove %s\n", name->name);
412 nfs_fattr_init(&res.dir_attr); 412 res.dir_attr = nfs_alloc_fattr();
413 if (res.dir_attr == NULL)
414 goto out;
415
413 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); 416 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
414 nfs_post_op_update_inode(dir, &res.dir_attr); 417 nfs_post_op_update_inode(dir, res.dir_attr);
418 nfs_free_fattr(res.dir_attr);
419out:
415 dprintk("NFS reply remove: %d\n", status); 420 dprintk("NFS reply remove: %d\n", status);
416 return status; 421 return status;
417} 422}
@@ -429,7 +434,7 @@ nfs3_proc_unlink_done(struct rpc_task *task, struct inode *dir)
429 if (nfs3_async_handle_jukebox(task, dir)) 434 if (nfs3_async_handle_jukebox(task, dir))
430 return 0; 435 return 0;
431 res = task->tk_msg.rpc_resp; 436 res = task->tk_msg.rpc_resp;
432 nfs_post_op_update_inode(dir, &res->dir_attr); 437 nfs_post_op_update_inode(dir, res->dir_attr);
433 return 1; 438 return 1;
434} 439}
435 440
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c
index 56a86f6ac8b5..75dcfc7da365 100644
--- a/fs/nfs/nfs3xdr.c
+++ b/fs/nfs/nfs3xdr.c
@@ -762,7 +762,7 @@ nfs3_xdr_wccstat(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
762static int 762static int
763nfs3_xdr_removeres(struct rpc_rqst *req, __be32 *p, struct nfs_removeres *res) 763nfs3_xdr_removeres(struct rpc_rqst *req, __be32 *p, struct nfs_removeres *res)
764{ 764{
765 return nfs3_xdr_wccstat(req, p, &res->dir_attr); 765 return nfs3_xdr_wccstat(req, p, res->dir_attr);
766} 766}
767 767
768/* 768/*
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 0ffd4cfd3b1f..d0cb6e163320 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2599,14 +2599,19 @@ static int _nfs4_proc_remove(struct inode *dir, struct qstr *name)
2599 .rpc_argp = &args, 2599 .rpc_argp = &args,
2600 .rpc_resp = &res, 2600 .rpc_resp = &res,
2601 }; 2601 };
2602 int status; 2602 int status = -ENOMEM;
2603
2604 res.dir_attr = nfs_alloc_fattr();
2605 if (res.dir_attr == NULL)
2606 goto out;
2603 2607
2604 nfs_fattr_init(&res.dir_attr);
2605 status = nfs4_call_sync(server, &msg, &args, &res, 1); 2608 status = nfs4_call_sync(server, &msg, &args, &res, 1);
2606 if (status == 0) { 2609 if (status == 0) {
2607 update_changeattr(dir, &res.cinfo); 2610 update_changeattr(dir, &res.cinfo);
2608 nfs_post_op_update_inode(dir, &res.dir_attr); 2611 nfs_post_op_update_inode(dir, res.dir_attr);
2609 } 2612 }
2613 nfs_free_fattr(res.dir_attr);
2614out:
2610 return status; 2615 return status;
2611} 2616}
2612 2617
@@ -2641,7 +2646,7 @@ static int nfs4_proc_unlink_done(struct rpc_task *task, struct inode *dir)
2641 if (nfs4_async_handle_error(task, res->server, NULL) == -EAGAIN) 2646 if (nfs4_async_handle_error(task, res->server, NULL) == -EAGAIN)
2642 return 0; 2647 return 0;
2643 update_changeattr(dir, &res->cinfo); 2648 update_changeattr(dir, &res->cinfo);
2644 nfs_post_op_update_inode(dir, &res->dir_attr); 2649 nfs_post_op_update_inode(dir, res->dir_attr);
2645 return 1; 2650 return 1;
2646} 2651}
2647 2652
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 38f3b582e7c2..890580642dc0 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -4815,7 +4815,7 @@ static int nfs4_xdr_dec_remove(struct rpc_rqst *rqstp, __be32 *p, struct nfs_rem
4815 goto out; 4815 goto out;
4816 if ((status = decode_remove(&xdr, &res->cinfo)) != 0) 4816 if ((status = decode_remove(&xdr, &res->cinfo)) != 0)
4817 goto out; 4817 goto out;
4818 decode_getfattr(&xdr, &res->dir_attr, res->server, 4818 decode_getfattr(&xdr, res->dir_attr, res->server,
4819 !RPC_IS_ASYNC(rqstp->rq_task)); 4819 !RPC_IS_ASYNC(rqstp->rq_task));
4820out: 4820out:
4821 return status; 4821 return status;
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
index 6da3d3ff6edd..a2242af6a17d 100644
--- a/fs/nfs/unlink.c
+++ b/fs/nfs/unlink.c
@@ -23,6 +23,7 @@ struct nfs_unlinkdata {
23 struct nfs_removeres res; 23 struct nfs_removeres res;
24 struct inode *dir; 24 struct inode *dir;
25 struct rpc_cred *cred; 25 struct rpc_cred *cred;
26 struct nfs_fattr dir_attr;
26}; 27};
27 28
28/** 29/**
@@ -169,7 +170,7 @@ static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct n
169 } 170 }
170 nfs_sb_active(dir->i_sb); 171 nfs_sb_active(dir->i_sb);
171 data->args.fh = NFS_FH(dir); 172 data->args.fh = NFS_FH(dir);
172 nfs_fattr_init(&data->res.dir_attr); 173 nfs_fattr_init(data->res.dir_attr);
173 174
174 NFS_PROTO(dir)->unlink_setup(&msg, dir); 175 NFS_PROTO(dir)->unlink_setup(&msg, dir);
175 176
@@ -259,6 +260,7 @@ nfs_async_unlink(struct inode *dir, struct dentry *dentry)
259 goto out_free; 260 goto out_free;
260 } 261 }
261 data->res.seq_res.sr_slotid = NFS4_MAX_SLOT_TABLE; 262 data->res.seq_res.sr_slotid = NFS4_MAX_SLOT_TABLE;
263 data->res.dir_attr = &data->dir_attr;
262 264
263 status = -EBUSY; 265 status = -EBUSY;
264 spin_lock(&dentry->d_lock); 266 spin_lock(&dentry->d_lock);