You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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>
This commit is contained in:
+14
-22
@@ -382,8 +382,6 @@ int ocfs2_init_acl(handle_t *handle,
|
||||
}
|
||||
}
|
||||
if ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) && acl) {
|
||||
struct posix_acl *clone;
|
||||
|
||||
if (S_ISDIR(inode->i_mode)) {
|
||||
ret = ocfs2_set_acl(handle, inode, di_bh,
|
||||
ACL_TYPE_DEFAULT, acl,
|
||||
@@ -391,28 +389,22 @@ int ocfs2_init_acl(handle_t *handle,
|
||||
if (ret)
|
||||
goto cleanup;
|
||||
}
|
||||
clone = posix_acl_clone(acl, GFP_NOFS);
|
||||
ret = -ENOMEM;
|
||||
if (!clone)
|
||||
goto cleanup;
|
||||
|
||||
mode = inode->i_mode;
|
||||
ret = posix_acl_create_masq(clone, &mode);
|
||||
if (ret >= 0) {
|
||||
ret2 = ocfs2_acl_set_mode(inode, di_bh, handle, mode);
|
||||
if (ret2) {
|
||||
mlog_errno(ret2);
|
||||
ret = ret2;
|
||||
posix_acl_release(clone);
|
||||
goto cleanup;
|
||||
}
|
||||
if (ret > 0) {
|
||||
ret = ocfs2_set_acl(handle, inode,
|
||||
di_bh, ACL_TYPE_ACCESS,
|
||||
clone, meta_ac, data_ac);
|
||||
}
|
||||
ret = posix_acl_create(&acl, GFP_NOFS, &mode);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret2 = ocfs2_acl_set_mode(inode, di_bh, handle, mode);
|
||||
if (ret2) {
|
||||
mlog_errno(ret2);
|
||||
ret = ret2;
|
||||
goto cleanup;
|
||||
}
|
||||
if (ret > 0) {
|
||||
ret = ocfs2_set_acl(handle, inode,
|
||||
di_bh, ACL_TYPE_ACCESS,
|
||||
acl, meta_ac, data_ac);
|
||||
}
|
||||
posix_acl_release(clone);
|
||||
}
|
||||
cleanup:
|
||||
posix_acl_release(acl);
|
||||
|
||||
Reference in New Issue
Block a user