aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2010-04-16 16:22:51 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-05-14 15:09:27 -0400
commit23a306120fcb2879ed2b814716c1cb2a8eb74f72 (patch)
treed2c8dfc11351be67956a095f82ee97417177f7d2 /fs/nfs
parenteb872f0c8e5c9801da05d5c2a6e402af8e27160e (diff)
NFS: Reduce the stack footprint of nfs_proc_symlink()
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/proc.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
index aa61f2c66068..611bec22f552 100644
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -418,8 +418,8 @@ static int
418nfs_proc_symlink(struct inode *dir, struct dentry *dentry, struct page *page, 418nfs_proc_symlink(struct inode *dir, struct dentry *dentry, struct page *page,
419 unsigned int len, struct iattr *sattr) 419 unsigned int len, struct iattr *sattr)
420{ 420{
421 struct nfs_fh fhandle; 421 struct nfs_fh *fh;
422 struct nfs_fattr fattr; 422 struct nfs_fattr *fattr;
423 struct nfs_symlinkargs arg = { 423 struct nfs_symlinkargs arg = {
424 .fromfh = NFS_FH(dir), 424 .fromfh = NFS_FH(dir),
425 .fromname = dentry->d_name.name, 425 .fromname = dentry->d_name.name,
@@ -432,12 +432,18 @@ nfs_proc_symlink(struct inode *dir, struct dentry *dentry, struct page *page,
432 .rpc_proc = &nfs_procedures[NFSPROC_SYMLINK], 432 .rpc_proc = &nfs_procedures[NFSPROC_SYMLINK],
433 .rpc_argp = &arg, 433 .rpc_argp = &arg,
434 }; 434 };
435 int status; 435 int status = -ENAMETOOLONG;
436
437 dprintk("NFS call symlink %s\n", dentry->d_name.name);
436 438
437 if (len > NFS2_MAXPATHLEN) 439 if (len > NFS2_MAXPATHLEN)
438 return -ENAMETOOLONG; 440 goto out;
439 441
440 dprintk("NFS call symlink %s\n", dentry->d_name.name); 442 fh = nfs_alloc_fhandle();
443 fattr = nfs_alloc_fattr();
444 status = -ENOMEM;
445 if (fh == NULL || fattr == NULL)
446 goto out;
441 447
442 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); 448 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
443 nfs_mark_for_revalidate(dir); 449 nfs_mark_for_revalidate(dir);
@@ -447,12 +453,12 @@ nfs_proc_symlink(struct inode *dir, struct dentry *dentry, struct page *page,
447 * filehandle size to zero indicates to nfs_instantiate that it 453 * filehandle size to zero indicates to nfs_instantiate that it
448 * should fill in the data with a LOOKUP call on the wire. 454 * should fill in the data with a LOOKUP call on the wire.
449 */ 455 */
450 if (status == 0) { 456 if (status == 0)
451 nfs_fattr_init(&fattr); 457 status = nfs_instantiate(dentry, fh, fattr);
452 fhandle.size = 0;
453 status = nfs_instantiate(dentry, &fhandle, &fattr);
454 }
455 458
459 nfs_free_fattr(fattr);
460 nfs_free_fhandle(fh);
461out:
456 dprintk("NFS reply symlink: %d\n", status); 462 dprintk("NFS reply symlink: %d\n", status);
457 return status; 463 return status;
458} 464}