aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2010-04-16 16:22:52 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-05-14 15:09:28 -0400
commit6e94d62993cb79397856f3330577917ca79cffa2 (patch)
treecfcc0698490f9973173fcb247f6ef5c10b5d432f /fs
parentca7e9a0df263493bbdf76f47fd9e9ac48ad6f331 (diff)
NFS: Reduce stack footprint of nfs3_proc_getacl() and nfs3_proc_setacl()
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs3acl.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c
index d150ae0c5ecd..9f88c5f4c7e2 100644
--- a/fs/nfs/nfs3acl.c
+++ b/fs/nfs/nfs3acl.c
@@ -185,7 +185,6 @@ static void nfs3_cache_acls(struct inode *inode, struct posix_acl *acl,
185struct posix_acl *nfs3_proc_getacl(struct inode *inode, int type) 185struct posix_acl *nfs3_proc_getacl(struct inode *inode, int type)
186{ 186{
187 struct nfs_server *server = NFS_SERVER(inode); 187 struct nfs_server *server = NFS_SERVER(inode);
188 struct nfs_fattr fattr;
189 struct page *pages[NFSACL_MAXPAGES] = { }; 188 struct page *pages[NFSACL_MAXPAGES] = { };
190 struct nfs3_getaclargs args = { 189 struct nfs3_getaclargs args = {
191 .fh = NFS_FH(inode), 190 .fh = NFS_FH(inode),
@@ -193,7 +192,7 @@ struct posix_acl *nfs3_proc_getacl(struct inode *inode, int type)
193 .pages = pages, 192 .pages = pages,
194 }; 193 };
195 struct nfs3_getaclres res = { 194 struct nfs3_getaclres res = {
196 .fattr = &fattr, 195 0
197 }; 196 };
198 struct rpc_message msg = { 197 struct rpc_message msg = {
199 .rpc_argp = &args, 198 .rpc_argp = &args,
@@ -228,7 +227,10 @@ struct posix_acl *nfs3_proc_getacl(struct inode *inode, int type)
228 227
229 dprintk("NFS call getacl\n"); 228 dprintk("NFS call getacl\n");
230 msg.rpc_proc = &server->client_acl->cl_procinfo[ACLPROC3_GETACL]; 229 msg.rpc_proc = &server->client_acl->cl_procinfo[ACLPROC3_GETACL];
231 nfs_fattr_init(&fattr); 230 res.fattr = nfs_alloc_fattr();
231 if (res.fattr == NULL)
232 return ERR_PTR(-ENOMEM);
233
232 status = rpc_call_sync(server->client_acl, &msg, 0); 234 status = rpc_call_sync(server->client_acl, &msg, 0);
233 dprintk("NFS reply getacl: %d\n", status); 235 dprintk("NFS reply getacl: %d\n", status);
234 236
@@ -238,7 +240,7 @@ struct posix_acl *nfs3_proc_getacl(struct inode *inode, int type)
238 240
239 switch (status) { 241 switch (status) {
240 case 0: 242 case 0:
241 status = nfs_refresh_inode(inode, &fattr); 243 status = nfs_refresh_inode(inode, res.fattr);
242 break; 244 break;
243 case -EPFNOSUPPORT: 245 case -EPFNOSUPPORT:
244 case -EPROTONOSUPPORT: 246 case -EPROTONOSUPPORT:
@@ -278,6 +280,7 @@ struct posix_acl *nfs3_proc_getacl(struct inode *inode, int type)
278getout: 280getout:
279 posix_acl_release(res.acl_access); 281 posix_acl_release(res.acl_access);
280 posix_acl_release(res.acl_default); 282 posix_acl_release(res.acl_default);
283 nfs_free_fattr(res.fattr);
281 284
282 if (status != 0) { 285 if (status != 0) {
283 posix_acl_release(acl); 286 posix_acl_release(acl);
@@ -290,7 +293,7 @@ static int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
290 struct posix_acl *dfacl) 293 struct posix_acl *dfacl)
291{ 294{
292 struct nfs_server *server = NFS_SERVER(inode); 295 struct nfs_server *server = NFS_SERVER(inode);
293 struct nfs_fattr fattr; 296 struct nfs_fattr *fattr;
294 struct page *pages[NFSACL_MAXPAGES]; 297 struct page *pages[NFSACL_MAXPAGES];
295 struct nfs3_setaclargs args = { 298 struct nfs3_setaclargs args = {
296 .inode = inode, 299 .inode = inode,
@@ -335,8 +338,13 @@ static int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
335 } 338 }
336 339
337 dprintk("NFS call setacl\n"); 340 dprintk("NFS call setacl\n");
341 status = -ENOMEM;
342 fattr = nfs_alloc_fattr();
343 if (fattr == NULL)
344 goto out_freepages;
345
338 msg.rpc_proc = &server->client_acl->cl_procinfo[ACLPROC3_SETACL]; 346 msg.rpc_proc = &server->client_acl->cl_procinfo[ACLPROC3_SETACL];
339 nfs_fattr_init(&fattr); 347 msg.rpc_resp = fattr;
340 status = rpc_call_sync(server->client_acl, &msg, 0); 348 status = rpc_call_sync(server->client_acl, &msg, 0);
341 nfs_access_zap_cache(inode); 349 nfs_access_zap_cache(inode);
342 nfs_zap_acl_cache(inode); 350 nfs_zap_acl_cache(inode);
@@ -344,7 +352,7 @@ static int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
344 352
345 switch (status) { 353 switch (status) {
346 case 0: 354 case 0:
347 status = nfs_refresh_inode(inode, &fattr); 355 status = nfs_refresh_inode(inode, fattr);
348 nfs3_cache_acls(inode, acl, dfacl); 356 nfs3_cache_acls(inode, acl, dfacl);
349 break; 357 break;
350 case -EPFNOSUPPORT: 358 case -EPFNOSUPPORT:
@@ -355,6 +363,7 @@ static int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
355 case -ENOTSUPP: 363 case -ENOTSUPP:
356 status = -EOPNOTSUPP; 364 status = -EOPNOTSUPP;
357 } 365 }
366 nfs_free_fattr(fattr);
358out_freepages: 367out_freepages:
359 while (args.npages != 0) { 368 while (args.npages != 0) {
360 args.npages--; 369 args.npages--;