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:
Al Viro
2011-07-23 03:10:32 -04:00
parent 95203befa8
commit 826cae2f2b
16 changed files with 114 additions and 202 deletions

View File

@@ -206,30 +206,18 @@ int v9fs_acl_mode(struct inode *dir, mode_t *modep,
mode &= ~current_umask();
}
if (acl) {
struct posix_acl *clone;
if (S_ISDIR(mode))
*dpacl = posix_acl_dup(acl);
clone = posix_acl_clone(acl, GFP_NOFS);
posix_acl_release(acl);
if (!clone)
return -ENOMEM;
retval = posix_acl_create_masq(clone, &mode);
if (retval < 0) {
posix_acl_release(clone);
goto cleanup;
}
retval = posix_acl_create(&acl, GFP_NOFS, &mode);
if (retval < 0)
return retval;
if (retval > 0)
*pacl = clone;
*pacl = acl;
else
posix_acl_release(clone);
posix_acl_release(acl);
}
*modep = mode;
return 0;
cleanup:
return retval;
}
static int v9fs_remote_get_acl(struct dentry *dentry, const char *name,