aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/acl.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-07-23 03:10:32 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2011-07-25 14:27:32 -0400
commit826cae2f2b4d726b925f43bc208a571639da4761 (patch)
treeb7f83eecf3bde8c4e455d89c7c535988b3e8bd59 /fs/ocfs2/acl.c
parent95203befa8887997f14077d8557e67d78457ee02 (diff)
kill boilerplates around posix_acl_create_masq()
new helper: posix_acl_create(&acl, gfp, mode_p). Replaces acl with modified clone, on failure releases acl and replaces with NULL. Returns 0 or -ve on error. All callers of posix_acl_create_masq() switched. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ocfs2/acl.c')
-rw-r--r--fs/ocfs2/acl.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
index dd0296ade181..480200e94e83 100644
--- a/fs/ocfs2/acl.c
+++ b/fs/ocfs2/acl.c
@@ -382,8 +382,6 @@ int ocfs2_init_acl(handle_t *handle,
382 } 382 }
383 } 383 }
384 if ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) && acl) { 384 if ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) && acl) {
385 struct posix_acl *clone;
386
387 if (S_ISDIR(inode->i_mode)) { 385 if (S_ISDIR(inode->i_mode)) {
388 ret = ocfs2_set_acl(handle, inode, di_bh, 386 ret = ocfs2_set_acl(handle, inode, di_bh,
389 ACL_TYPE_DEFAULT, acl, 387 ACL_TYPE_DEFAULT, acl,
@@ -391,28 +389,22 @@ int ocfs2_init_acl(handle_t *handle,
391 if (ret) 389 if (ret)
392 goto cleanup; 390 goto cleanup;
393 } 391 }
394 clone = posix_acl_clone(acl, GFP_NOFS);
395 ret = -ENOMEM;
396 if (!clone)
397 goto cleanup;
398
399 mode = inode->i_mode; 392 mode = inode->i_mode;
400 ret = posix_acl_create_masq(clone, &mode); 393 ret = posix_acl_create(&acl, GFP_NOFS, &mode);
401 if (ret >= 0) { 394 if (ret < 0)
402 ret2 = ocfs2_acl_set_mode(inode, di_bh, handle, mode); 395 return ret;
403 if (ret2) { 396
404 mlog_errno(ret2); 397 ret2 = ocfs2_acl_set_mode(inode, di_bh, handle, mode);
405 ret = ret2; 398 if (ret2) {
406 posix_acl_release(clone); 399 mlog_errno(ret2);
407 goto cleanup; 400 ret = ret2;
408 } 401 goto cleanup;
409 if (ret > 0) { 402 }
410 ret = ocfs2_set_acl(handle, inode, 403 if (ret > 0) {
411 di_bh, ACL_TYPE_ACCESS, 404 ret = ocfs2_set_acl(handle, inode,
412 clone, meta_ac, data_ac); 405 di_bh, ACL_TYPE_ACCESS,
413 } 406 acl, meta_ac, data_ac);
414 } 407 }
415 posix_acl_release(clone);
416 } 408 }
417cleanup: 409cleanup:
418 posix_acl_release(acl); 410 posix_acl_release(acl);