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/xfs/linux-2.6 | |
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/xfs/linux-2.6')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_acl.c | 28 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 2 |
2 files changed, 12 insertions, 18 deletions
diff --git a/fs/xfs/linux-2.6/xfs_acl.c b/fs/xfs/linux-2.6/xfs_acl.c index 4c554122db02..2827bbd8366e 100644 --- a/fs/xfs/linux-2.6/xfs_acl.c +++ b/fs/xfs/linux-2.6/xfs_acl.c | |||
@@ -282,29 +282,23 @@ posix_acl_default_exists(struct inode *inode) | |||
282 | * No need for i_mutex because the inode is not yet exposed to the VFS. | 282 | * No need for i_mutex because the inode is not yet exposed to the VFS. |
283 | */ | 283 | */ |
284 | int | 284 | int |
285 | xfs_inherit_acl(struct inode *inode, struct posix_acl *default_acl) | 285 | xfs_inherit_acl(struct inode *inode, struct posix_acl *acl) |
286 | { | 286 | { |
287 | struct posix_acl *clone; | 287 | mode_t mode = inode->i_mode; |
288 | mode_t mode; | ||
289 | int error = 0, inherit = 0; | 288 | int error = 0, inherit = 0; |
290 | 289 | ||
291 | if (S_ISDIR(inode->i_mode)) { | 290 | if (S_ISDIR(inode->i_mode)) { |
292 | error = xfs_set_acl(inode, ACL_TYPE_DEFAULT, default_acl); | 291 | error = xfs_set_acl(inode, ACL_TYPE_DEFAULT, acl); |
293 | if (error) | 292 | if (error) |
294 | return error; | 293 | goto out; |
295 | } | 294 | } |
296 | 295 | ||
297 | clone = posix_acl_clone(default_acl, GFP_KERNEL); | 296 | error = posix_acl_create(&acl, GFP_KERNEL, &mode); |
298 | if (!clone) | ||
299 | return -ENOMEM; | ||
300 | |||
301 | mode = inode->i_mode; | ||
302 | error = posix_acl_create_masq(clone, &mode); | ||
303 | if (error < 0) | 297 | if (error < 0) |
304 | goto out_release_clone; | 298 | return error; |
305 | 299 | ||
306 | /* | 300 | /* |
307 | * If posix_acl_create_masq returns a positive value we need to | 301 | * If posix_acl_create returns a positive value we need to |
308 | * inherit a permission that can't be represented using the Unix | 302 | * inherit a permission that can't be represented using the Unix |
309 | * mode bits and we actually need to set an ACL. | 303 | * mode bits and we actually need to set an ACL. |
310 | */ | 304 | */ |
@@ -313,13 +307,13 @@ xfs_inherit_acl(struct inode *inode, struct posix_acl *default_acl) | |||
313 | 307 | ||
314 | error = xfs_set_mode(inode, mode); | 308 | error = xfs_set_mode(inode, mode); |
315 | if (error) | 309 | if (error) |
316 | goto out_release_clone; | 310 | goto out; |
317 | 311 | ||
318 | if (inherit) | 312 | if (inherit) |
319 | error = xfs_set_acl(inode, ACL_TYPE_ACCESS, clone); | 313 | error = xfs_set_acl(inode, ACL_TYPE_ACCESS, acl); |
320 | 314 | ||
321 | out_release_clone: | 315 | out: |
322 | posix_acl_release(clone); | 316 | posix_acl_release(acl); |
323 | return error; | 317 | return error; |
324 | } | 318 | } |
325 | 319 | ||
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index de666917db06..77463dd55198 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
@@ -202,9 +202,9 @@ xfs_vn_mknod( | |||
202 | 202 | ||
203 | if (default_acl) { | 203 | if (default_acl) { |
204 | error = -xfs_inherit_acl(inode, default_acl); | 204 | error = -xfs_inherit_acl(inode, default_acl); |
205 | default_acl = NULL; | ||
205 | if (unlikely(error)) | 206 | if (unlikely(error)) |
206 | goto out_cleanup_inode; | 207 | goto out_cleanup_inode; |
207 | posix_acl_release(default_acl); | ||
208 | } | 208 | } |
209 | 209 | ||
210 | 210 | ||