diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-07-23 03:10:32 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-07-25 14:27:32 -0400 |
commit | 826cae2f2b4d726b925f43bc208a571639da4761 (patch) | |
tree | b7f83eecf3bde8c4e455d89c7c535988b3e8bd59 /fs/btrfs/acl.c | |
parent | 95203befa8887997f14077d8557e67d78457ee02 (diff) |
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>
Diffstat (limited to 'fs/btrfs/acl.c')
-rw-r--r-- | fs/btrfs/acl.c | 24 |
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 | } |
267 | failed: | 259 | failed: |
268 | posix_acl_release(acl); | 260 | posix_acl_release(acl); |