aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-07-23 00:18:02 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2011-07-25 14:27:30 -0400
commitbc26ab5f65ae41b71df86ea46df3c3833d1d8d83 (patch)
tree85bbc4e0da4fac99ccf31b3609c61e2b148a8498
parent4482a087d4c5a6ffbc385c56b4a4e2f694d9fd5d (diff)
kill boilerplate around posix_acl_chmod_masq()
new helper: posix_acl_chmod(&acl, gfp, mode). Replaces acl with modified clone or with NULL if that has failed; returns 0 or -ve on error. All callers of posix_acl_chmod_masq() switched to that - they'd been doing exactly the same thing. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/9p/acl.c13
-rw-r--r--fs/btrfs/acl.c16
-rw-r--r--fs/ext2/acl.c13
-rw-r--r--fs/ext3/acl.c43
-rw-r--r--fs/ext4/acl.c44
-rw-r--r--fs/generic_acl.c13
-rw-r--r--fs/gfs2/acl.c30
-rw-r--r--fs/jffs2/acl.c13
-rw-r--r--fs/jfs/acl.c31
-rw-r--r--fs/ocfs2/acl.c15
-rw-r--r--fs/posix_acl.c18
-rw-r--r--fs/reiserfs/xattr_acl.c41
-rw-r--r--fs/xfs/linux-2.6/xfs_acl.c16
-rw-r--r--include/linux/posix_acl.h1
14 files changed, 139 insertions, 168 deletions
diff --git a/fs/9p/acl.c b/fs/9p/acl.c
index df4d7a171d7..d7211e28c0d 100644
--- a/fs/9p/acl.c
+++ b/fs/9p/acl.c
@@ -162,21 +162,18 @@ err_free_out:
162int v9fs_acl_chmod(struct dentry *dentry) 162int v9fs_acl_chmod(struct dentry *dentry)
163{ 163{
164 int retval = 0; 164 int retval = 0;
165 struct posix_acl *acl, *clone; 165 struct posix_acl *acl;
166 struct inode *inode = dentry->d_inode; 166 struct inode *inode = dentry->d_inode;
167 167
168 if (S_ISLNK(inode->i_mode)) 168 if (S_ISLNK(inode->i_mode))
169 return -EOPNOTSUPP; 169 return -EOPNOTSUPP;
170 acl = v9fs_get_cached_acl(inode, ACL_TYPE_ACCESS); 170 acl = v9fs_get_cached_acl(inode, ACL_TYPE_ACCESS);
171 if (acl) { 171 if (acl) {
172 clone = posix_acl_clone(acl, GFP_KERNEL); 172 retval = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
173 if (retval)
174 return retval;
175 retval = v9fs_set_acl(dentry, ACL_TYPE_ACCESS, acl);
173 posix_acl_release(acl); 176 posix_acl_release(acl);
174 if (!clone)
175 return -ENOMEM;
176 retval = posix_acl_chmod_masq(clone, inode->i_mode);
177 if (!retval)
178 retval = v9fs_set_acl(dentry, ACL_TYPE_ACCESS, clone);
179 posix_acl_release(clone);
180 } 177 }
181 return retval; 178 return retval;
182} 179}
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
index c13ea9fbf36..88bca53b302 100644
--- a/fs/btrfs/acl.c
+++ b/fs/btrfs/acl.c
@@ -272,7 +272,7 @@ failed:
272 272
273int btrfs_acl_chmod(struct inode *inode) 273int btrfs_acl_chmod(struct inode *inode)
274{ 274{
275 struct posix_acl *acl, *clone; 275 struct posix_acl *acl;
276 int ret = 0; 276 int ret = 0;
277 277
278 if (S_ISLNK(inode->i_mode)) 278 if (S_ISLNK(inode->i_mode))
@@ -285,17 +285,11 @@ int btrfs_acl_chmod(struct inode *inode)
285 if (IS_ERR_OR_NULL(acl)) 285 if (IS_ERR_OR_NULL(acl))
286 return PTR_ERR(acl); 286 return PTR_ERR(acl);
287 287
288 clone = posix_acl_clone(acl, GFP_KERNEL); 288 ret = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
289 if (ret)
290 return ret;
291 ret = btrfs_set_acl(NULL, inode, acl, ACL_TYPE_ACCESS);
289 posix_acl_release(acl); 292 posix_acl_release(acl);
290 if (!clone)
291 return -ENOMEM;
292
293 ret = posix_acl_chmod_masq(clone, inode->i_mode);
294 if (!ret)
295 ret = btrfs_set_acl(NULL, inode, clone, ACL_TYPE_ACCESS);
296
297 posix_acl_release(clone);
298
299 return ret; 293 return ret;
300} 294}
301 295
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
index ced1c478ebd..1226dbcc66f 100644
--- a/fs/ext2/acl.c
+++ b/fs/ext2/acl.c
@@ -316,7 +316,7 @@ cleanup:
316int 316int
317ext2_acl_chmod(struct inode *inode) 317ext2_acl_chmod(struct inode *inode)
318{ 318{
319 struct posix_acl *acl, *clone; 319 struct posix_acl *acl;
320 int error; 320 int error;
321 321
322 if (!test_opt(inode->i_sb, POSIX_ACL)) 322 if (!test_opt(inode->i_sb, POSIX_ACL))
@@ -326,14 +326,11 @@ ext2_acl_chmod(struct inode *inode)
326 acl = ext2_get_acl(inode, ACL_TYPE_ACCESS); 326 acl = ext2_get_acl(inode, ACL_TYPE_ACCESS);
327 if (IS_ERR(acl) || !acl) 327 if (IS_ERR(acl) || !acl)
328 return PTR_ERR(acl); 328 return PTR_ERR(acl);
329 clone = posix_acl_clone(acl, GFP_KERNEL); 329 error = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
330 if (error)
331 return error;
332 error = ext2_set_acl(inode, ACL_TYPE_ACCESS, acl);
330 posix_acl_release(acl); 333 posix_acl_release(acl);
331 if (!clone)
332 return -ENOMEM;
333 error = posix_acl_chmod_masq(clone, inode->i_mode);
334 if (!error)
335 error = ext2_set_acl(inode, ACL_TYPE_ACCESS, clone);
336 posix_acl_release(clone);
337 return error; 334 return error;
338} 335}
339 336
diff --git a/fs/ext3/acl.c b/fs/ext3/acl.c
index 5326038e853..7ea638acaec 100644
--- a/fs/ext3/acl.c
+++ b/fs/ext3/acl.c
@@ -326,7 +326,9 @@ cleanup:
326int 326int
327ext3_acl_chmod(struct inode *inode) 327ext3_acl_chmod(struct inode *inode)
328{ 328{
329 struct posix_acl *acl, *clone; 329 struct posix_acl *acl;
330 handle_t *handle;
331 int retries = 0;
330 int error; 332 int error;
331 333
332 if (S_ISLNK(inode->i_mode)) 334 if (S_ISLNK(inode->i_mode))
@@ -336,31 +338,24 @@ ext3_acl_chmod(struct inode *inode)
336 acl = ext3_get_acl(inode, ACL_TYPE_ACCESS); 338 acl = ext3_get_acl(inode, ACL_TYPE_ACCESS);
337 if (IS_ERR(acl) || !acl) 339 if (IS_ERR(acl) || !acl)
338 return PTR_ERR(acl); 340 return PTR_ERR(acl);
339 clone = posix_acl_clone(acl, GFP_KERNEL); 341 error = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
340 posix_acl_release(acl); 342 if (error)
341 if (!clone) 343 return error;
342 return -ENOMEM; 344retry:
343 error = posix_acl_chmod_masq(clone, inode->i_mode); 345 handle = ext3_journal_start(inode,
344 if (!error) { 346 EXT3_DATA_TRANS_BLOCKS(inode->i_sb));
345 handle_t *handle; 347 if (IS_ERR(handle)) {
346 int retries = 0; 348 error = PTR_ERR(handle);
347 349 ext3_std_error(inode->i_sb, error);
348 retry: 350 goto out;
349 handle = ext3_journal_start(inode,
350 EXT3_DATA_TRANS_BLOCKS(inode->i_sb));
351 if (IS_ERR(handle)) {
352 error = PTR_ERR(handle);
353 ext3_std_error(inode->i_sb, error);
354 goto out;
355 }
356 error = ext3_set_acl(handle, inode, ACL_TYPE_ACCESS, clone);
357 ext3_journal_stop(handle);
358 if (error == -ENOSPC &&
359 ext3_should_retry_alloc(inode->i_sb, &retries))
360 goto retry;
361 } 351 }
352 error = ext3_set_acl(handle, inode, ACL_TYPE_ACCESS, acl);
353 ext3_journal_stop(handle);
354 if (error == -ENOSPC &&
355 ext3_should_retry_alloc(inode->i_sb, &retries))
356 goto retry;
362out: 357out:
363 posix_acl_release(clone); 358 posix_acl_release(acl);
364 return error; 359 return error;
365} 360}
366 361
diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c
index 4cd9e2e4085..e38a2047d24 100644
--- a/fs/ext4/acl.c
+++ b/fs/ext4/acl.c
@@ -324,9 +324,12 @@ cleanup:
324int 324int
325ext4_acl_chmod(struct inode *inode) 325ext4_acl_chmod(struct inode *inode)
326{ 326{
327 struct posix_acl *acl, *clone; 327 struct posix_acl *acl;
328 handle_t *handle;
329 int retries = 0;
328 int error; 330 int error;
329 331
332
330 if (S_ISLNK(inode->i_mode)) 333 if (S_ISLNK(inode->i_mode))
331 return -EOPNOTSUPP; 334 return -EOPNOTSUPP;
332 if (!test_opt(inode->i_sb, POSIX_ACL)) 335 if (!test_opt(inode->i_sb, POSIX_ACL))
@@ -334,31 +337,24 @@ ext4_acl_chmod(struct inode *inode)
334 acl = ext4_get_acl(inode, ACL_TYPE_ACCESS); 337 acl = ext4_get_acl(inode, ACL_TYPE_ACCESS);
335 if (IS_ERR(acl) || !acl) 338 if (IS_ERR(acl) || !acl)
336 return PTR_ERR(acl); 339 return PTR_ERR(acl);
337 clone = posix_acl_clone(acl, GFP_KERNEL); 340 error = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
338 posix_acl_release(acl); 341 if (error)
339 if (!clone) 342 return error;
340 return -ENOMEM; 343retry:
341 error = posix_acl_chmod_masq(clone, inode->i_mode); 344 handle = ext4_journal_start(inode,
342 if (!error) { 345 EXT4_DATA_TRANS_BLOCKS(inode->i_sb));
343 handle_t *handle; 346 if (IS_ERR(handle)) {
344 int retries = 0; 347 error = PTR_ERR(handle);
345 348 ext4_std_error(inode->i_sb, error);
346 retry: 349 goto out;
347 handle = ext4_journal_start(inode,
348 EXT4_DATA_TRANS_BLOCKS(inode->i_sb));
349 if (IS_ERR(handle)) {
350 error = PTR_ERR(handle);
351 ext4_std_error(inode->i_sb, error);
352 goto out;
353 }
354 error = ext4_set_acl(handle, inode, ACL_TYPE_ACCESS, clone);
355 ext4_journal_stop(handle);
356 if (error == -ENOSPC &&
357 ext4_should_retry_alloc(inode->i_sb, &retries))
358 goto retry;
359 } 350 }
351 error = ext4_set_acl(handle, inode, ACL_TYPE_ACCESS, acl);
352 ext4_journal_stop(handle);
353 if (error == -ENOSPC &&
354 ext4_should_retry_alloc(inode->i_sb, &retries))
355 goto retry;
360out: 356out:
361 posix_acl_release(clone); 357 posix_acl_release(acl);
362 return error; 358 return error;
363} 359}
364 360
diff --git a/fs/generic_acl.c b/fs/generic_acl.c
index 4949473d354..3a60d9d1653 100644
--- a/fs/generic_acl.c
+++ b/fs/generic_acl.c
@@ -170,21 +170,18 @@ cleanup:
170int 170int
171generic_acl_chmod(struct inode *inode) 171generic_acl_chmod(struct inode *inode)
172{ 172{
173 struct posix_acl *acl, *clone; 173 struct posix_acl *acl;
174 int error = 0; 174 int error = 0;
175 175
176 if (S_ISLNK(inode->i_mode)) 176 if (S_ISLNK(inode->i_mode))
177 return -EOPNOTSUPP; 177 return -EOPNOTSUPP;
178 acl = get_cached_acl(inode, ACL_TYPE_ACCESS); 178 acl = get_cached_acl(inode, ACL_TYPE_ACCESS);
179 if (acl) { 179 if (acl) {
180 clone = posix_acl_clone(acl, GFP_KERNEL); 180 error = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
181 if (error)
182 return error;
183 set_cached_acl(inode, ACL_TYPE_ACCESS, acl);
181 posix_acl_release(acl); 184 posix_acl_release(acl);
182 if (!clone)
183 return -ENOMEM;
184 error = posix_acl_chmod_masq(clone, inode->i_mode);
185 if (!error)
186 set_cached_acl(inode, ACL_TYPE_ACCESS, clone);
187 posix_acl_release(clone);
188 } 185 }
189 return error; 186 return error;
190} 187}
diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c
index 48171f4c943..160d4e1575c 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);
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
index 4933a8f8ecc..71d022d3850 100644
--- a/fs/jffs2/acl.c
+++ b/fs/jffs2/acl.c
@@ -332,7 +332,7 @@ int jffs2_init_acl_post(struct inode *inode)
332 332
333int jffs2_acl_chmod(struct inode *inode) 333int jffs2_acl_chmod(struct inode *inode)
334{ 334{
335 struct posix_acl *acl, *clone; 335 struct posix_acl *acl;
336 int rc; 336 int rc;
337 337
338 if (S_ISLNK(inode->i_mode)) 338 if (S_ISLNK(inode->i_mode))
@@ -340,14 +340,11 @@ int jffs2_acl_chmod(struct inode *inode)
340 acl = jffs2_get_acl(inode, ACL_TYPE_ACCESS); 340 acl = jffs2_get_acl(inode, ACL_TYPE_ACCESS);
341 if (IS_ERR(acl) || !acl) 341 if (IS_ERR(acl) || !acl)
342 return PTR_ERR(acl); 342 return PTR_ERR(acl);
343 clone = posix_acl_clone(acl, GFP_KERNEL); 343 rc = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
344 if (rc)
345 return rc;
346 rc = jffs2_set_acl(inode, ACL_TYPE_ACCESS, acl);
344 posix_acl_release(acl); 347 posix_acl_release(acl);
345 if (!clone)
346 return -ENOMEM;
347 rc = posix_acl_chmod_masq(clone, inode->i_mode);
348 if (!rc)
349 rc = jffs2_set_acl(inode, ACL_TYPE_ACCESS, clone);
350 posix_acl_release(clone);
351 return rc; 348 return rc;
352} 349}
353 350
diff --git a/fs/jfs/acl.c b/fs/jfs/acl.c
index ead200eef5e..89ced71e225 100644
--- a/fs/jfs/acl.c
+++ b/fs/jfs/acl.c
@@ -177,8 +177,9 @@ cleanup:
177 177
178int jfs_acl_chmod(struct inode *inode) 178int jfs_acl_chmod(struct inode *inode)
179{ 179{
180 struct posix_acl *acl, *clone; 180 struct posix_acl *acl;
181 int rc; 181 int rc;
182 tid_t tid;
182 183
183 if (S_ISLNK(inode->i_mode)) 184 if (S_ISLNK(inode->i_mode))
184 return -EOPNOTSUPP; 185 return -EOPNOTSUPP;
@@ -187,22 +188,18 @@ int jfs_acl_chmod(struct inode *inode)
187 if (IS_ERR(acl) || !acl) 188 if (IS_ERR(acl) || !acl)
188 return PTR_ERR(acl); 189 return PTR_ERR(acl);
189 190
190 clone = posix_acl_clone(acl, GFP_KERNEL); 191 rc = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
191 posix_acl_release(acl); 192 if (rc)
192 if (!clone) 193 return rc;
193 return -ENOMEM;
194
195 rc = posix_acl_chmod_masq(clone, inode->i_mode);
196 if (!rc) {
197 tid_t tid = txBegin(inode->i_sb, 0);
198 mutex_lock(&JFS_IP(inode)->commit_mutex);
199 rc = jfs_set_acl(tid, inode, ACL_TYPE_ACCESS, clone);
200 if (!rc)
201 rc = txCommit(tid, 1, &inode, 0);
202 txEnd(tid);
203 mutex_unlock(&JFS_IP(inode)->commit_mutex);
204 }
205 194
206 posix_acl_release(clone); 195 tid = txBegin(inode->i_sb, 0);
196 mutex_lock(&JFS_IP(inode)->commit_mutex);
197 rc = jfs_set_acl(tid, inode, ACL_TYPE_ACCESS, acl);
198 if (!rc)
199 rc = txCommit(tid, 1, &inode, 0);
200 txEnd(tid);
201 mutex_unlock(&JFS_IP(inode)->commit_mutex);
202
203 posix_acl_release(acl);
207 return rc; 204 return rc;
208} 205}
diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
index aff23e59b58..dd0296ade18 100644
--- a/fs/ocfs2/acl.c
+++ b/fs/ocfs2/acl.c
@@ -327,7 +327,7 @@ int ocfs2_check_acl(struct inode *inode, int mask)
327int ocfs2_acl_chmod(struct inode *inode) 327int ocfs2_acl_chmod(struct inode *inode)
328{ 328{
329 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 329 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
330 struct posix_acl *acl, *clone; 330 struct posix_acl *acl;
331 int ret; 331 int ret;
332 332
333 if (S_ISLNK(inode->i_mode)) 333 if (S_ISLNK(inode->i_mode))
@@ -339,15 +339,12 @@ int ocfs2_acl_chmod(struct inode *inode)
339 acl = ocfs2_get_acl(inode, ACL_TYPE_ACCESS); 339 acl = ocfs2_get_acl(inode, ACL_TYPE_ACCESS);
340 if (IS_ERR(acl) || !acl) 340 if (IS_ERR(acl) || !acl)
341 return PTR_ERR(acl); 341 return PTR_ERR(acl);
342 clone = posix_acl_clone(acl, GFP_KERNEL); 342 ret = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
343 if (ret)
344 return ret;
345 ret = ocfs2_set_acl(NULL, inode, NULL, ACL_TYPE_ACCESS,
346 acl, NULL, NULL);
343 posix_acl_release(acl); 347 posix_acl_release(acl);
344 if (!clone)
345 return -ENOMEM;
346 ret = posix_acl_chmod_masq(clone, inode->i_mode);
347 if (!ret)
348 ret = ocfs2_set_acl(NULL, inode, NULL, ACL_TYPE_ACCESS,
349 clone, NULL, NULL);
350 posix_acl_release(clone);
351 return ret; 348 return ret;
352} 349}
353 350
diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index b1cf6bf4b41..0aa9f167672 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -386,3 +386,21 @@ posix_acl_chmod_masq(struct posix_acl *acl, mode_t mode)
386 386
387 return 0; 387 return 0;
388} 388}
389
390int
391posix_acl_chmod(struct posix_acl **acl, gfp_t gfp, mode_t mode)
392{
393 struct posix_acl *clone = posix_acl_clone(*acl, gfp);
394 int err = -ENOMEM;
395 if (clone) {
396 err = posix_acl_chmod_masq(clone, mode);
397 if (err) {
398 posix_acl_release(clone);
399 clone = NULL;
400 }
401 }
402 posix_acl_release(*acl);
403 *acl = clone;
404 return err;
405}
406EXPORT_SYMBOL(posix_acl_chmod);
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c
index 3dc38f1206f..26b08acf913 100644
--- a/fs/reiserfs/xattr_acl.c
+++ b/fs/reiserfs/xattr_acl.c
@@ -445,7 +445,10 @@ int reiserfs_cache_default_acl(struct inode *inode)
445 445
446int reiserfs_acl_chmod(struct inode *inode) 446int reiserfs_acl_chmod(struct inode *inode)
447{ 447{
448 struct posix_acl *acl, *clone; 448 struct reiserfs_transaction_handle th;
449 struct posix_acl *acl;
450 size_t size;
451 int depth;
449 int error; 452 int error;
450 453
451 if (S_ISLNK(inode->i_mode)) 454 if (S_ISLNK(inode->i_mode))
@@ -463,30 +466,22 @@ int reiserfs_acl_chmod(struct inode *inode)
463 return 0; 466 return 0;
464 if (IS_ERR(acl)) 467 if (IS_ERR(acl))
465 return PTR_ERR(acl); 468 return PTR_ERR(acl);
466 clone = posix_acl_clone(acl, GFP_NOFS); 469 error = posix_acl_chmod(&acl, GFP_NOFS, inode->i_mode);
467 posix_acl_release(acl); 470 if (error)
468 if (!clone) 471 return error;
469 return -ENOMEM; 472
470 error = posix_acl_chmod_masq(clone, inode->i_mode); 473 size = reiserfs_xattr_nblocks(inode, reiserfs_acl_size(acl->a_count));
474 depth = reiserfs_write_lock_once(inode->i_sb);
475 error = journal_begin(&th, inode->i_sb, size * 2);
471 if (!error) { 476 if (!error) {
472 struct reiserfs_transaction_handle th; 477 int error2;
473 size_t size = reiserfs_xattr_nblocks(inode, 478 error = reiserfs_set_acl(&th, inode, ACL_TYPE_ACCESS, acl);
474 reiserfs_acl_size(clone->a_count)); 479 error2 = journal_end(&th, inode->i_sb, size * 2);
475 int depth; 480 if (error2)
476 481 error = error2;
477 depth = reiserfs_write_lock_once(inode->i_sb);
478 error = journal_begin(&th, inode->i_sb, size * 2);
479 if (!error) {
480 int error2;
481 error = reiserfs_set_acl(&th, inode, ACL_TYPE_ACCESS,
482 clone);
483 error2 = journal_end(&th, inode->i_sb, size * 2);
484 if (error2)
485 error = error2;
486 }
487 reiserfs_write_unlock_once(inode->i_sb, depth);
488 } 482 }
489 posix_acl_release(clone); 483 reiserfs_write_unlock_once(inode->i_sb, depth);
484 posix_acl_release(acl);
490 return error; 485 return error;
491} 486}
492 487
diff --git a/fs/xfs/linux-2.6/xfs_acl.c b/fs/xfs/linux-2.6/xfs_acl.c
index 13c4e4fd5c6..4c554122db0 100644
--- a/fs/xfs/linux-2.6/xfs_acl.c
+++ b/fs/xfs/linux-2.6/xfs_acl.c
@@ -326,7 +326,7 @@ xfs_inherit_acl(struct inode *inode, struct posix_acl *default_acl)
326int 326int
327xfs_acl_chmod(struct inode *inode) 327xfs_acl_chmod(struct inode *inode)
328{ 328{
329 struct posix_acl *acl, *clone; 329 struct posix_acl *acl;
330 int error; 330 int error;
331 331
332 if (S_ISLNK(inode->i_mode)) 332 if (S_ISLNK(inode->i_mode))
@@ -336,16 +336,12 @@ xfs_acl_chmod(struct inode *inode)
336 if (IS_ERR(acl) || !acl) 336 if (IS_ERR(acl) || !acl)
337 return PTR_ERR(acl); 337 return PTR_ERR(acl);
338 338
339 clone = posix_acl_clone(acl, GFP_KERNEL); 339 error = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
340 posix_acl_release(acl); 340 if (error)
341 if (!clone) 341 return error;
342 return -ENOMEM;
343
344 error = posix_acl_chmod_masq(clone, inode->i_mode);
345 if (!error)
346 error = xfs_set_acl(inode, ACL_TYPE_ACCESS, clone);
347 342
348 posix_acl_release(clone); 343 error = xfs_set_acl(inode, ACL_TYPE_ACCESS, acl);
344 posix_acl_release(acl);
349 return error; 345 return error;
350} 346}
351 347
diff --git a/include/linux/posix_acl.h b/include/linux/posix_acl.h
index 54211c1cd92..7a74d37482e 100644
--- a/include/linux/posix_acl.h
+++ b/include/linux/posix_acl.h
@@ -80,6 +80,7 @@ extern struct posix_acl *posix_acl_from_mode(mode_t, gfp_t);
80extern int posix_acl_equiv_mode(const struct posix_acl *, mode_t *); 80extern int posix_acl_equiv_mode(const struct posix_acl *, mode_t *);
81extern int posix_acl_create_masq(struct posix_acl *, mode_t *); 81extern int posix_acl_create_masq(struct posix_acl *, mode_t *);
82extern int posix_acl_chmod_masq(struct posix_acl *, mode_t); 82extern int posix_acl_chmod_masq(struct posix_acl *, mode_t);
83extern int posix_acl_chmod(struct posix_acl **, gfp_t, mode_t);
83 84
84extern struct posix_acl *get_posix_acl(struct inode *, int); 85extern struct posix_acl *get_posix_acl(struct inode *, int);
85extern int set_posix_acl(struct inode *, int, struct posix_acl *); 86extern int set_posix_acl(struct inode *, int, struct posix_acl *);