aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_acl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_acl.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_acl.c28
1 files changed, 11 insertions, 17 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 */
284int 284int
285xfs_inherit_acl(struct inode *inode, struct posix_acl *default_acl) 285xfs_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: 315out:
322 posix_acl_release(clone); 316 posix_acl_release(acl);
323 return error; 317 return error;
324} 318}
325 319