aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-07-23 03:10:32 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2011-07-25 14:27:32 -0400
commit826cae2f2b4d726b925f43bc208a571639da4761 (patch)
treeb7f83eecf3bde8c4e455d89c7c535988b3e8bd59 /fs/ext4
parent95203befa8887997f14077d8557e67d78457ee02 (diff)
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>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/acl.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c
index e38a2047d246..7b094d1a8d3e 100644
--- a/fs/ext4/acl.c
+++ b/fs/ext4/acl.c
@@ -276,8 +276,7 @@ ext4_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
276 inode->i_mode &= ~current_umask(); 276 inode->i_mode &= ~current_umask();
277 } 277 }
278 if (test_opt(inode->i_sb, POSIX_ACL) && acl) { 278 if (test_opt(inode->i_sb, POSIX_ACL) && acl) {
279 struct posix_acl *clone; 279 mode_t mode = inode->i_mode;
280 mode_t mode;
281 280
282 if (S_ISDIR(inode->i_mode)) { 281 if (S_ISDIR(inode->i_mode)) {
283 error = ext4_set_acl(handle, inode, 282 error = ext4_set_acl(handle, inode,
@@ -285,22 +284,15 @@ ext4_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
285 if (error) 284 if (error)
286 goto cleanup; 285 goto cleanup;
287 } 286 }
288 clone = posix_acl_clone(acl, GFP_NOFS); 287 error = posix_acl_create(&acl, GFP_NOFS, &mode);
289 error = -ENOMEM; 288 if (error < 0)
290 if (!clone) 289 return error;
291 goto cleanup; 290
292 291 inode->i_mode = mode;
293 mode = inode->i_mode; 292 if (error > 0) {
294 error = posix_acl_create_masq(clone, &mode); 293 /* This is an extended ACL */
295 if (error >= 0) { 294 error = ext4_set_acl(handle, inode, ACL_TYPE_ACCESS, acl);
296 inode->i_mode = mode;
297 if (error > 0) {
298 /* This is an extended ACL */
299 error = ext4_set_acl(handle, inode,
300 ACL_TYPE_ACCESS, clone);
301 }
302 } 295 }
303 posix_acl_release(clone);
304 } 296 }
305cleanup: 297cleanup:
306 posix_acl_release(acl); 298 posix_acl_release(acl);