aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext2/acl.c
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/ext2/acl.c
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/ext2/acl.c')
-rw-r--r--fs/ext2/acl.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
index 1226dbcc66f5..ba99fa4b2f35 100644
--- a/fs/ext2/acl.c
+++ b/fs/ext2/acl.c
@@ -270,29 +270,20 @@ ext2_init_acl(struct inode *inode, struct inode *dir)
270 inode->i_mode &= ~current_umask(); 270 inode->i_mode &= ~current_umask();
271 } 271 }
272 if (test_opt(inode->i_sb, POSIX_ACL) && acl) { 272 if (test_opt(inode->i_sb, POSIX_ACL) && acl) {
273 struct posix_acl *clone; 273 mode_t mode = inode->i_mode;
274 mode_t mode;
275
276 if (S_ISDIR(inode->i_mode)) { 274 if (S_ISDIR(inode->i_mode)) {
277 error = ext2_set_acl(inode, ACL_TYPE_DEFAULT, acl); 275 error = ext2_set_acl(inode, ACL_TYPE_DEFAULT, acl);
278 if (error) 276 if (error)
279 goto cleanup; 277 goto cleanup;
280 } 278 }
281 clone = posix_acl_clone(acl, GFP_KERNEL); 279 error = posix_acl_create(&acl, GFP_KERNEL, &mode);
282 error = -ENOMEM; 280 if (error < 0)
283 if (!clone) 281 return error;
284 goto cleanup; 282 inode->i_mode = mode;
285 mode = inode->i_mode; 283 if (error > 0) {
286 error = posix_acl_create_masq(clone, &mode); 284 /* This is an extended ACL */
287 if (error >= 0) { 285 error = ext2_set_acl(inode, ACL_TYPE_ACCESS, acl);
288 inode->i_mode = mode;
289 if (error > 0) {
290 /* This is an extended ACL */
291 error = ext2_set_acl(inode,
292 ACL_TYPE_ACCESS, clone);
293 }
294 } 286 }
295 posix_acl_release(clone);
296 } 287 }
297cleanup: 288cleanup:
298 posix_acl_release(acl); 289 posix_acl_release(acl);