kill boilerplate around posix_acl_chmod_masq()
[firefly-linux-kernel-4.4.55.git] / fs / ocfs2 / acl.c
index e913ad130fdd2cf9eafa0e73e343bad5974583e9..dd0296ade181e2dc607a583063fb2650d22256ea 100644 (file)
@@ -290,16 +290,13 @@ static int ocfs2_set_acl(handle_t *handle,
        return ret;
 }
 
-int ocfs2_check_acl(struct inode *inode, int mask, unsigned int flags)
+int ocfs2_check_acl(struct inode *inode, int mask)
 {
        struct ocfs2_super *osb;
        struct buffer_head *di_bh = NULL;
        struct posix_acl *acl;
        int ret = -EAGAIN;
 
-       if (flags & IPERM_FLAG_RCU)
-               return -ECHILD;
-
        osb = OCFS2_SB(inode->i_sb);
        if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
                return ret;
@@ -330,7 +327,7 @@ int ocfs2_check_acl(struct inode *inode, int mask, unsigned int flags)
 int ocfs2_acl_chmod(struct inode *inode)
 {
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
-       struct posix_acl *acl, *clone;
+       struct posix_acl *acl;
        int ret;
 
        if (S_ISLNK(inode->i_mode))
@@ -342,15 +339,12 @@ int ocfs2_acl_chmod(struct inode *inode)
        acl = ocfs2_get_acl(inode, ACL_TYPE_ACCESS);
        if (IS_ERR(acl) || !acl)
                return PTR_ERR(acl);
-       clone = posix_acl_clone(acl, GFP_KERNEL);
+       ret = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
+       if (ret)
+               return ret;
+       ret = ocfs2_set_acl(NULL, inode, NULL, ACL_TYPE_ACCESS,
+                           acl, NULL, NULL);
        posix_acl_release(acl);
-       if (!clone)
-               return -ENOMEM;
-       ret = posix_acl_chmod_masq(clone, inode->i_mode);
-       if (!ret)
-               ret = ocfs2_set_acl(NULL, inode, NULL, ACL_TYPE_ACCESS,
-                                   clone, NULL, NULL);
-       posix_acl_release(clone);
        return ret;
 }
 
@@ -409,6 +403,7 @@ int ocfs2_init_acl(handle_t *handle,
                        if (ret2) {
                                mlog_errno(ret2);
                                ret = ret2;
+                               posix_acl_release(clone);
                                goto cleanup;
                        }
                        if (ret > 0) {