aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3/acl.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-07-23 00:18:02 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2011-07-25 14:27:30 -0400
commitbc26ab5f65ae41b71df86ea46df3c3833d1d8d83 (patch)
tree85bbc4e0da4fac99ccf31b3609c61e2b148a8498 /fs/ext3/acl.c
parent4482a087d4c5a6ffbc385c56b4a4e2f694d9fd5d (diff)
kill boilerplate around posix_acl_chmod_masq()
new helper: posix_acl_chmod(&acl, gfp, mode). Replaces acl with modified clone or with NULL if that has failed; returns 0 or -ve on error. All callers of posix_acl_chmod_masq() switched to that - they'd been doing exactly the same thing. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ext3/acl.c')
-rw-r--r--fs/ext3/acl.c43
1 files changed, 19 insertions, 24 deletions
diff --git a/fs/ext3/acl.c b/fs/ext3/acl.c
index 5326038e8536..7ea638acaecf 100644
--- a/fs/ext3/acl.c
+++ b/fs/ext3/acl.c
@@ -326,7 +326,9 @@ cleanup:
326int 326int
327ext3_acl_chmod(struct inode *inode) 327ext3_acl_chmod(struct inode *inode)
328{ 328{
329 struct posix_acl *acl, *clone; 329 struct posix_acl *acl;
330 handle_t *handle;
331 int retries = 0;
330 int error; 332 int error;
331 333
332 if (S_ISLNK(inode->i_mode)) 334 if (S_ISLNK(inode->i_mode))
@@ -336,31 +338,24 @@ ext3_acl_chmod(struct inode *inode)
336 acl = ext3_get_acl(inode, ACL_TYPE_ACCESS); 338 acl = ext3_get_acl(inode, ACL_TYPE_ACCESS);
337 if (IS_ERR(acl) || !acl) 339 if (IS_ERR(acl) || !acl)
338 return PTR_ERR(acl); 340 return PTR_ERR(acl);
339 clone = posix_acl_clone(acl, GFP_KERNEL); 341 error = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
340 posix_acl_release(acl); 342 if (error)
341 if (!clone) 343 return error;
342 return -ENOMEM; 344retry:
343 error = posix_acl_chmod_masq(clone, inode->i_mode); 345 handle = ext3_journal_start(inode,
344 if (!error) { 346 EXT3_DATA_TRANS_BLOCKS(inode->i_sb));
345 handle_t *handle; 347 if (IS_ERR(handle)) {
346 int retries = 0; 348 error = PTR_ERR(handle);
347 349 ext3_std_error(inode->i_sb, error);
348 retry: 350 goto out;
349 handle = ext3_journal_start(inode,
350 EXT3_DATA_TRANS_BLOCKS(inode->i_sb));
351 if (IS_ERR(handle)) {
352 error = PTR_ERR(handle);
353 ext3_std_error(inode->i_sb, error);
354 goto out;
355 }
356 error = ext3_set_acl(handle, inode, ACL_TYPE_ACCESS, clone);
357 ext3_journal_stop(handle);
358 if (error == -ENOSPC &&
359 ext3_should_retry_alloc(inode->i_sb, &retries))
360 goto retry;
361 } 351 }
352 error = ext3_set_acl(handle, inode, ACL_TYPE_ACCESS, acl);
353 ext3_journal_stop(handle);
354 if (error == -ENOSPC &&
355 ext3_should_retry_alloc(inode->i_sb, &retries))
356 goto retry;
362out: 357out:
363 posix_acl_release(clone); 358 posix_acl_release(acl);
364 return error; 359 return error;
365} 360}
366 361