|
@@ -86,19 +86,6 @@ int __gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
|
|
|
char *data;
|
|
|
const char *name = gfs2_acl_name(type);
|
|
|
|
|
|
- if (acl && acl->a_count > GFS2_ACL_MAX_ENTRIES(GFS2_SB(inode)))
|
|
|
- return -E2BIG;
|
|
|
-
|
|
|
- if (type == ACL_TYPE_ACCESS) {
|
|
|
- umode_t mode = inode->i_mode;
|
|
|
-
|
|
|
- error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
|
|
|
- if (error)
|
|
|
- return error;
|
|
|
- if (mode != inode->i_mode)
|
|
|
- mark_inode_dirty(inode);
|
|
|
- }
|
|
|
-
|
|
|
if (acl) {
|
|
|
len = posix_acl_to_xattr(&init_user_ns, acl, NULL, 0);
|
|
|
if (len == 0)
|
|
@@ -130,6 +117,9 @@ int gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
|
|
|
bool need_unlock = false;
|
|
|
int ret;
|
|
|
|
|
|
+ if (acl && acl->a_count > GFS2_ACL_MAX_ENTRIES(GFS2_SB(inode)))
|
|
|
+ return -E2BIG;
|
|
|
+
|
|
|
ret = gfs2_rsqa_alloc(ip);
|
|
|
if (ret)
|
|
|
return ret;
|
|
@@ -140,7 +130,18 @@ int gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
|
|
|
return ret;
|
|
|
need_unlock = true;
|
|
|
}
|
|
|
+ if (type == ACL_TYPE_ACCESS && acl) {
|
|
|
+ umode_t mode = inode->i_mode;
|
|
|
+
|
|
|
+ ret = posix_acl_update_mode(inode, &inode->i_mode, &acl);
|
|
|
+ if (ret)
|
|
|
+ goto unlock;
|
|
|
+ if (mode != inode->i_mode)
|
|
|
+ mark_inode_dirty(inode);
|
|
|
+ }
|
|
|
+
|
|
|
ret = __gfs2_set_acl(inode, acl, type);
|
|
|
+unlock:
|
|
|
if (need_unlock)
|
|
|
gfs2_glock_dq_uninit(&gh);
|
|
|
return ret;
|