aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/acl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/acl.c')
-rw-r--r--fs/gfs2/acl.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c
index 48171f4c943d..160d4e1575ce 100644
--- a/fs/gfs2/acl.c
+++ b/fs/gfs2/acl.c
@@ -187,7 +187,7 @@ out:
187 187
188int gfs2_acl_chmod(struct gfs2_inode *ip, struct iattr *attr) 188int gfs2_acl_chmod(struct gfs2_inode *ip, struct iattr *attr)
189{ 189{
190 struct posix_acl *acl, *clone; 190 struct posix_acl *acl;
191 char *data; 191 char *data;
192 unsigned int len; 192 unsigned int len;
193 int error; 193 int error;
@@ -198,25 +198,19 @@ int gfs2_acl_chmod(struct gfs2_inode *ip, struct iattr *attr)
198 if (!acl) 198 if (!acl)
199 return gfs2_setattr_simple(ip, attr); 199 return gfs2_setattr_simple(ip, attr);
200 200
201 clone = posix_acl_clone(acl, GFP_NOFS); 201 error = posix_acl_chmod(&acl, GFP_NOFS, attr->ia_mode);
202 if (error)
203 return error;
204
205 len = posix_acl_to_xattr(acl, NULL, 0);
206 data = kmalloc(len, GFP_NOFS);
202 error = -ENOMEM; 207 error = -ENOMEM;
203 if (!clone) 208 if (data == NULL)
204 goto out; 209 goto out;
205 posix_acl_release(acl); 210 posix_acl_to_xattr(acl, data, len);
206 acl = clone; 211 error = gfs2_xattr_acl_chmod(ip, attr, data);
207 212 kfree(data);
208 error = posix_acl_chmod_masq(acl, attr->ia_mode); 213 set_cached_acl(&ip->i_inode, ACL_TYPE_ACCESS, acl);
209 if (!error) {
210 len = posix_acl_to_xattr(acl, NULL, 0);
211 data = kmalloc(len, GFP_NOFS);
212 error = -ENOMEM;
213 if (data == NULL)
214 goto out;
215 posix_acl_to_xattr(acl, data, len);
216 error = gfs2_xattr_acl_chmod(ip, attr, data);
217 kfree(data);
218 set_cached_acl(&ip->i_inode, ACL_TYPE_ACCESS, acl);
219 }
220 214
221out: 215out:
222 posix_acl_release(acl); 216 posix_acl_release(acl);