Commit a4d7f16806e98cee752006d3a8c10067a7c2aa6b

Authored by Trond Myklebust
1 parent 815409d22d

NFS: Reduce the stack footprint of nfs_follow_mountpoint()

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

Showing 1 changed file with 14 additions and 6 deletions Side-by-side Diff

... ... @@ -105,8 +105,8 @@
105 105 struct vfsmount *mnt;
106 106 struct nfs_server *server = NFS_SERVER(dentry->d_inode);
107 107 struct dentry *parent;
108   - struct nfs_fh fh;
109   - struct nfs_fattr fattr;
  108 + struct nfs_fh *fh = NULL;
  109 + struct nfs_fattr *fattr = NULL;
110 110 int err;
111 111  
112 112 dprintk("--> nfs_follow_mountpoint()\n");
... ... @@ -115,6 +115,12 @@
115 115 if (IS_ROOT(dentry))
116 116 goto out_err;
117 117  
  118 + err = -ENOMEM;
  119 + fh = nfs_alloc_fhandle();
  120 + fattr = nfs_alloc_fattr();
  121 + if (fh == NULL || fattr == NULL)
  122 + goto out_err;
  123 +
118 124 dprintk("%s: enter\n", __func__);
119 125 dput(nd->path.dentry);
120 126 nd->path.dentry = dget(dentry);
121 127  
122 128  
... ... @@ -123,16 +129,16 @@
123 129 parent = dget_parent(nd->path.dentry);
124 130 err = server->nfs_client->rpc_ops->lookup(parent->d_inode,
125 131 &nd->path.dentry->d_name,
126   - &fh, &fattr);
  132 + fh, fattr);
127 133 dput(parent);
128 134 if (err != 0)
129 135 goto out_err;
130 136  
131   - if (fattr.valid & NFS_ATTR_FATTR_V4_REFERRAL)
  137 + if (fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL)
132 138 mnt = nfs_do_refmount(nd->path.mnt, nd->path.dentry);
133 139 else
134   - mnt = nfs_do_submount(nd->path.mnt, nd->path.dentry, &fh,
135   - &fattr);
  140 + mnt = nfs_do_submount(nd->path.mnt, nd->path.dentry, fh,
  141 + fattr);
136 142 err = PTR_ERR(mnt);
137 143 if (IS_ERR(mnt))
138 144 goto out_err;
... ... @@ -151,6 +157,8 @@
151 157 nd->path.dentry = dget(mnt->mnt_root);
152 158 schedule_delayed_work(&nfs_automount_task, nfs_mountpoint_expiry_timeout);
153 159 out:
  160 + nfs_free_fattr(fattr);
  161 + nfs_free_fhandle(fh);
154 162 dprintk("%s: done, returned %d\n", __func__, err);
155 163  
156 164 dprintk("<-- nfs_follow_mountpoint() = %d\n", err);