diff options
Diffstat (limited to 'fs/btrfs/acl.c')
-rw-r--r-- | fs/btrfs/acl.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index 2e9e69987a82..6ef7b26724ec 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/posix_acl_xattr.h> | 22 | #include <linux/posix_acl_xattr.h> |
23 | #include <linux/posix_acl.h> | 23 | #include <linux/posix_acl.h> |
24 | #include <linux/sched.h> | 24 | #include <linux/sched.h> |
25 | #include <linux/slab.h> | ||
25 | 26 | ||
26 | #include "ctree.h" | 27 | #include "ctree.h" |
27 | #include "btrfs_inode.h" | 28 | #include "btrfs_inode.h" |
@@ -112,12 +113,14 @@ static int btrfs_set_acl(struct btrfs_trans_handle *trans, | |||
112 | switch (type) { | 113 | switch (type) { |
113 | case ACL_TYPE_ACCESS: | 114 | case ACL_TYPE_ACCESS: |
114 | mode = inode->i_mode; | 115 | mode = inode->i_mode; |
115 | ret = posix_acl_equiv_mode(acl, &mode); | ||
116 | if (ret < 0) | ||
117 | return ret; | ||
118 | ret = 0; | ||
119 | inode->i_mode = mode; | ||
120 | name = POSIX_ACL_XATTR_ACCESS; | 116 | name = POSIX_ACL_XATTR_ACCESS; |
117 | if (acl) { | ||
118 | ret = posix_acl_equiv_mode(acl, &mode); | ||
119 | if (ret < 0) | ||
120 | return ret; | ||
121 | inode->i_mode = mode; | ||
122 | } | ||
123 | ret = 0; | ||
121 | break; | 124 | break; |
122 | case ACL_TYPE_DEFAULT: | 125 | case ACL_TYPE_DEFAULT: |
123 | if (!S_ISDIR(inode->i_mode)) | 126 | if (!S_ISDIR(inode->i_mode)) |
@@ -242,6 +245,7 @@ int btrfs_init_acl(struct btrfs_trans_handle *trans, | |||
242 | ACL_TYPE_ACCESS); | 245 | ACL_TYPE_ACCESS); |
243 | } | 246 | } |
244 | } | 247 | } |
248 | posix_acl_release(clone); | ||
245 | } | 249 | } |
246 | failed: | 250 | failed: |
247 | posix_acl_release(acl); | 251 | posix_acl_release(acl); |