aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
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/ext4
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/ext4')
-rw-r--r--fs/ext4/acl.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c
index 4cd9e2e4085e..e38a2047d246 100644
--- a/fs/ext4/acl.c
+++ b/fs/ext4/acl.c
@@ -324,9 +324,12 @@ cleanup:
324int 324int
325ext4_acl_chmod(struct inode *inode) 325ext4_acl_chmod(struct inode *inode)
326{ 326{
327 struct posix_acl *acl, *clone; 327 struct posix_acl *acl;
328 handle_t *handle;
329 int retries = 0;
328 int error; 330 int error;
329 331
332
330 if (S_ISLNK(inode->i_mode)) 333 if (S_ISLNK(inode->i_mode))
331 return -EOPNOTSUPP; 334 return -EOPNOTSUPP;
332 if (!test_opt(inode->i_sb, POSIX_ACL)) 335 if (!test_opt(inode->i_sb, POSIX_ACL))
@@ -334,31 +337,24 @@ ext4_acl_chmod(struct inode *inode)
334 acl = ext4_get_acl(inode, ACL_TYPE_ACCESS); 337 acl = ext4_get_acl(inode, ACL_TYPE_ACCESS);
335 if (IS_ERR(acl) || !acl) 338 if (IS_ERR(acl) || !acl)
336 return PTR_ERR(acl); 339 return PTR_ERR(acl);
337 clone = posix_acl_clone(acl, GFP_KERNEL); 340 error = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
338 posix_acl_release(acl); 341 if (error)
339 if (!clone) 342 return error;
340 return -ENOMEM; 343retry:
341 error = posix_acl_chmod_masq(clone, inode->i_mode); 344 handle = ext4_journal_start(inode,
342 if (!error) { 345 EXT4_DATA_TRANS_BLOCKS(inode->i_sb));
343 handle_t *handle; 346 if (IS_ERR(handle)) {
344 int retries = 0; 347 error = PTR_ERR(handle);
345 348 ext4_std_error(inode->i_sb, error);
346 retry: 349 goto out;
347 handle = ext4_journal_start(inode,
348 EXT4_DATA_TRANS_BLOCKS(inode->i_sb));
349 if (IS_ERR(handle)) {
350 error = PTR_ERR(handle);
351 ext4_std_error(inode->i_sb, error);
352 goto out;
353 }
354 error = ext4_set_acl(handle, inode, ACL_TYPE_ACCESS, clone);
355 ext4_journal_stop(handle);
356 if (error == -ENOSPC &&
357 ext4_should_retry_alloc(inode->i_sb, &retries))
358 goto retry;
359 } 350 }
351 error = ext4_set_acl(handle, inode, ACL_TYPE_ACCESS, acl);
352 ext4_journal_stop(handle);
353 if (error == -ENOSPC &&
354 ext4_should_retry_alloc(inode->i_sb, &retries))
355 goto retry;
360out: 356out:
361 posix_acl_release(clone); 357 posix_acl_release(acl);
362 return error; 358 return error;
363} 359}
364 360