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>
This commit is contained in:
@ -278,8 +278,7 @@ ext3_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
|
||||
inode->i_mode &= ~current_umask();
|
||||
}
|
||||
if (test_opt(inode->i_sb, POSIX_ACL) && acl) {
|
||||
struct posix_acl *clone;
|
||||
mode_t mode;
|
||||
mode_t mode = inode->i_mode;
|
||||
|
||||
if (S_ISDIR(inode->i_mode)) {
|
||||
error = ext3_set_acl(handle, inode,
|
||||
@ -287,22 +286,15 @@ ext3_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
|
||||
if (error)
|
||||
goto cleanup;
|
||||
}
|
||||
clone = posix_acl_clone(acl, GFP_NOFS);
|
||||
error = -ENOMEM;
|
||||
if (!clone)
|
||||
goto cleanup;
|
||||
error = posix_acl_create(&acl, GFP_NOFS, &mode);
|
||||
if (error < 0)
|
||||
return error;
|
||||
|
||||
mode = inode->i_mode;
|
||||
error = posix_acl_create_masq(clone, &mode);
|
||||
if (error >= 0) {
|
||||
inode->i_mode = mode;
|
||||
if (error > 0) {
|
||||
/* This is an extended ACL */
|
||||
error = ext3_set_acl(handle, inode,
|
||||
ACL_TYPE_ACCESS, clone);
|
||||
}
|
||||
inode->i_mode = mode;
|
||||
if (error > 0) {
|
||||
/* This is an extended ACL */
|
||||
error = ext3_set_acl(handle, inode, ACL_TYPE_ACCESS, acl);
|
||||
}
|
||||
posix_acl_release(clone);
|
||||
}
|
||||
cleanup:
|
||||
posix_acl_release(acl);
|
||||
|
Reference in New Issue
Block a user