diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-04-16 16:22:48 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-05-14 15:09:24 -0400 |
commit | c407d41a1612aa487f5a9cb5338ed7dc60fe1da2 (patch) | |
tree | c5ad78292ca176a223bf9ea71703a5a372118f8c /fs/nfs/nfs3proc.c | |
parent | 4f727296d2428b60138793a0a1207a4085eacf99 (diff) |
NFSv4: Reduce stack footprint of nfs4_proc_access() and nfs3_proc_access()
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs3proc.c')
-rw-r--r-- | fs/nfs/nfs3proc.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index 72334c19d481..9d5d02f02515 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
@@ -181,13 +181,10 @@ nfs3_proc_lookup(struct inode *dir, struct qstr *name, | |||
181 | 181 | ||
182 | static int nfs3_proc_access(struct inode *inode, struct nfs_access_entry *entry) | 182 | static int nfs3_proc_access(struct inode *inode, struct nfs_access_entry *entry) |
183 | { | 183 | { |
184 | struct nfs_fattr fattr; | ||
185 | struct nfs3_accessargs arg = { | 184 | struct nfs3_accessargs arg = { |
186 | .fh = NFS_FH(inode), | 185 | .fh = NFS_FH(inode), |
187 | }; | 186 | }; |
188 | struct nfs3_accessres res = { | 187 | struct nfs3_accessres res; |
189 | .fattr = &fattr, | ||
190 | }; | ||
191 | struct rpc_message msg = { | 188 | struct rpc_message msg = { |
192 | .rpc_proc = &nfs3_procedures[NFS3PROC_ACCESS], | 189 | .rpc_proc = &nfs3_procedures[NFS3PROC_ACCESS], |
193 | .rpc_argp = &arg, | 190 | .rpc_argp = &arg, |
@@ -195,7 +192,7 @@ static int nfs3_proc_access(struct inode *inode, struct nfs_access_entry *entry) | |||
195 | .rpc_cred = entry->cred, | 192 | .rpc_cred = entry->cred, |
196 | }; | 193 | }; |
197 | int mode = entry->mask; | 194 | int mode = entry->mask; |
198 | int status; | 195 | int status = -ENOMEM; |
199 | 196 | ||
200 | dprintk("NFS call access\n"); | 197 | dprintk("NFS call access\n"); |
201 | 198 | ||
@@ -212,9 +209,13 @@ static int nfs3_proc_access(struct inode *inode, struct nfs_access_entry *entry) | |||
212 | if (mode & MAY_EXEC) | 209 | if (mode & MAY_EXEC) |
213 | arg.access |= NFS3_ACCESS_EXECUTE; | 210 | arg.access |= NFS3_ACCESS_EXECUTE; |
214 | } | 211 | } |
215 | nfs_fattr_init(&fattr); | 212 | |
213 | res.fattr = nfs_alloc_fattr(); | ||
214 | if (res.fattr == NULL) | ||
215 | goto out; | ||
216 | |||
216 | status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); | 217 | status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); |
217 | nfs_refresh_inode(inode, &fattr); | 218 | nfs_refresh_inode(inode, res.fattr); |
218 | if (status == 0) { | 219 | if (status == 0) { |
219 | entry->mask = 0; | 220 | entry->mask = 0; |
220 | if (res.access & NFS3_ACCESS_READ) | 221 | if (res.access & NFS3_ACCESS_READ) |
@@ -224,6 +225,8 @@ static int nfs3_proc_access(struct inode *inode, struct nfs_access_entry *entry) | |||
224 | if (res.access & (NFS3_ACCESS_LOOKUP|NFS3_ACCESS_EXECUTE)) | 225 | if (res.access & (NFS3_ACCESS_LOOKUP|NFS3_ACCESS_EXECUTE)) |
225 | entry->mask |= MAY_EXEC; | 226 | entry->mask |= MAY_EXEC; |
226 | } | 227 | } |
228 | nfs_free_fattr(res.fattr); | ||
229 | out: | ||
227 | dprintk("NFS reply access: %d\n", status); | 230 | dprintk("NFS reply access: %d\n", status); |
228 | return status; | 231 | return status; |
229 | } | 232 | } |