aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/acl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/acl.c')
-rw-r--r--fs/btrfs/acl.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
index 88bca53b302a..9508ad14c924 100644
--- a/fs/btrfs/acl.c
+++ b/fs/btrfs/acl.c
@@ -238,8 +238,7 @@ int btrfs_init_acl(struct btrfs_trans_handle *trans,
238 } 238 }
239 239
240 if (IS_POSIXACL(dir) && acl) { 240 if (IS_POSIXACL(dir) && acl) {
241 struct posix_acl *clone; 241 mode_t mode = inode->i_mode;
242 mode_t mode;
243 242
244 if (S_ISDIR(inode->i_mode)) { 243 if (S_ISDIR(inode->i_mode)) {
245 ret = btrfs_set_acl(trans, inode, acl, 244 ret = btrfs_set_acl(trans, inode, acl,
@@ -247,22 +246,15 @@ int btrfs_init_acl(struct btrfs_trans_handle *trans,
247 if (ret) 246 if (ret)
248 goto failed; 247 goto failed;
249 } 248 }
250 clone = posix_acl_clone(acl, GFP_NOFS); 249 ret = posix_acl_create(&acl, GFP_NOFS, &mode);
251 ret = -ENOMEM; 250 if (ret < 0)
252 if (!clone) 251 return ret;
253 goto failed;
254 252
255 mode = inode->i_mode; 253 inode->i_mode = mode;
256 ret = posix_acl_create_masq(clone, &mode); 254 if (ret > 0) {
257 if (ret >= 0) { 255 /* we need an acl */
258 inode->i_mode = mode; 256 ret = btrfs_set_acl(trans, inode, acl, ACL_TYPE_ACCESS);
259 if (ret > 0) {
260 /* we need an acl */
261 ret = btrfs_set_acl(trans, inode, clone,
262 ACL_TYPE_ACCESS);
263 }
264 } 257 }
265 posix_acl_release(clone);
266 } 258 }
267failed: 259failed:
268 posix_acl_release(acl); 260 posix_acl_release(acl);