|
@@ -282,29 +282,23 @@ posix_acl_default_exists(struct inode *inode)
|
|
* No need for i_mutex because the inode is not yet exposed to the VFS.
|
|
* No need for i_mutex because the inode is not yet exposed to the VFS.
|
|
*/
|
|
*/
|
|
int
|
|
int
|
|
-xfs_inherit_acl(struct inode *inode, struct posix_acl *default_acl)
|
|
|
|
|
|
+xfs_inherit_acl(struct inode *inode, struct posix_acl *acl)
|
|
{
|
|
{
|
|
- struct posix_acl *clone;
|
|
|
|
- mode_t mode;
|
|
|
|
|
|
+ mode_t mode = inode->i_mode;
|
|
int error = 0, inherit = 0;
|
|
int error = 0, inherit = 0;
|
|
|
|
|
|
if (S_ISDIR(inode->i_mode)) {
|
|
if (S_ISDIR(inode->i_mode)) {
|
|
- error = xfs_set_acl(inode, ACL_TYPE_DEFAULT, default_acl);
|
|
|
|
|
|
+ error = xfs_set_acl(inode, ACL_TYPE_DEFAULT, acl);
|
|
if (error)
|
|
if (error)
|
|
- return error;
|
|
|
|
|
|
+ goto out;
|
|
}
|
|
}
|
|
|
|
|
|
- clone = posix_acl_clone(default_acl, GFP_KERNEL);
|
|
|
|
- if (!clone)
|
|
|
|
- return -ENOMEM;
|
|
|
|
-
|
|
|
|
- mode = inode->i_mode;
|
|
|
|
- error = posix_acl_create_masq(clone, &mode);
|
|
|
|
|
|
+ error = posix_acl_create(&acl, GFP_KERNEL, &mode);
|
|
if (error < 0)
|
|
if (error < 0)
|
|
- goto out_release_clone;
|
|
|
|
|
|
+ return error;
|
|
|
|
|
|
/*
|
|
/*
|
|
- * If posix_acl_create_masq returns a positive value we need to
|
|
|
|
|
|
+ * If posix_acl_create returns a positive value we need to
|
|
* inherit a permission that can't be represented using the Unix
|
|
* inherit a permission that can't be represented using the Unix
|
|
* mode bits and we actually need to set an ACL.
|
|
* mode bits and we actually need to set an ACL.
|
|
*/
|
|
*/
|
|
@@ -313,13 +307,13 @@ xfs_inherit_acl(struct inode *inode, struct posix_acl *default_acl)
|
|
|
|
|
|
error = xfs_set_mode(inode, mode);
|
|
error = xfs_set_mode(inode, mode);
|
|
if (error)
|
|
if (error)
|
|
- goto out_release_clone;
|
|
|
|
|
|
+ goto out;
|
|
|
|
|
|
if (inherit)
|
|
if (inherit)
|
|
- error = xfs_set_acl(inode, ACL_TYPE_ACCESS, clone);
|
|
|
|
|
|
+ error = xfs_set_acl(inode, ACL_TYPE_ACCESS, acl);
|
|
|
|
|
|
- out_release_clone:
|
|
|
|
- posix_acl_release(clone);
|
|
|
|
|
|
+out:
|
|
|
|
+ posix_acl_release(acl);
|
|
return error;
|
|
return error;
|
|
}
|
|
}
|
|
|
|
|