aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_acl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_acl.c')
-rw-r--r--fs/xfs/xfs_acl.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c
index 4ca4beb7bb54..5bfb66f33caf 100644
--- a/fs/xfs/xfs_acl.c
+++ b/fs/xfs/xfs_acl.c
@@ -32,6 +32,7 @@
32#include "xfs_btree.h" 32#include "xfs_btree.h"
33#include "xfs_acl.h" 33#include "xfs_acl.h"
34#include "xfs_attr.h" 34#include "xfs_attr.h"
35#include "xfs_vnodeops.h"
35 36
36#include <linux/capability.h> 37#include <linux/capability.h>
37#include <linux/posix_acl_xattr.h> 38#include <linux/posix_acl_xattr.h>
@@ -241,7 +242,7 @@ xfs_acl_vget(
241 bhv_vattr_t va; 242 bhv_vattr_t va;
242 243
243 va.va_mask = XFS_AT_MODE; 244 va.va_mask = XFS_AT_MODE;
244 error = bhv_vop_getattr(vp, &va, 0, sys_cred); 245 error = xfs_getattr(xfs_vtoi(vp), &va, 0);
245 if (error) 246 if (error)
246 goto out; 247 goto out;
247 xfs_acl_sync_mode(va.va_mode, xfs_acl); 248 xfs_acl_sync_mode(va.va_mode, xfs_acl);
@@ -265,9 +266,10 @@ xfs_acl_vremove(
265 VN_HOLD(vp); 266 VN_HOLD(vp);
266 error = xfs_acl_allow_set(vp, kind); 267 error = xfs_acl_allow_set(vp, kind);
267 if (!error) { 268 if (!error) {
268 error = bhv_vop_attr_remove(vp, kind == _ACL_TYPE_DEFAULT? 269 error = xfs_attr_remove(xfs_vtoi(vp),
270 kind == _ACL_TYPE_DEFAULT?
269 SGI_ACL_DEFAULT: SGI_ACL_FILE, 271 SGI_ACL_DEFAULT: SGI_ACL_FILE,
270 ATTR_ROOT, sys_cred); 272 ATTR_ROOT);
271 if (error == ENOATTR) 273 if (error == ENOATTR)
272 error = 0; /* 'scool */ 274 error = 0; /* 'scool */
273 } 275 }
@@ -370,17 +372,18 @@ xfs_acl_allow_set(
370 bhv_vnode_t *vp, 372 bhv_vnode_t *vp,
371 int kind) 373 int kind)
372{ 374{
375 xfs_inode_t *ip = xfs_vtoi(vp);
373 bhv_vattr_t va; 376 bhv_vattr_t va;
374 int error; 377 int error;
375 378
376 if (vp->v_inode.i_flags & (S_IMMUTABLE|S_APPEND)) 379 if (vp->i_flags & (S_IMMUTABLE|S_APPEND))
377 return EPERM; 380 return EPERM;
378 if (kind == _ACL_TYPE_DEFAULT && !VN_ISDIR(vp)) 381 if (kind == _ACL_TYPE_DEFAULT && !VN_ISDIR(vp))
379 return ENOTDIR; 382 return ENOTDIR;
380 if (vp->v_vfsp->vfs_flag & VFS_RDONLY) 383 if (vp->i_sb->s_flags & MS_RDONLY)
381 return EROFS; 384 return EROFS;
382 va.va_mask = XFS_AT_UID; 385 va.va_mask = XFS_AT_UID;
383 error = bhv_vop_getattr(vp, &va, 0, NULL); 386 error = xfs_getattr(ip, &va, 0);
384 if (error) 387 if (error)
385 return error; 388 return error;
386 if (va.va_uid != current->fsuid && !capable(CAP_FOWNER)) 389 if (va.va_uid != current->fsuid && !capable(CAP_FOWNER))
@@ -613,7 +616,8 @@ xfs_acl_get_attr(
613 616
614 ASSERT((flags & ATTR_KERNOVAL) ? (aclp == NULL) : 1); 617 ASSERT((flags & ATTR_KERNOVAL) ? (aclp == NULL) : 1);
615 flags |= ATTR_ROOT; 618 flags |= ATTR_ROOT;
616 *error = bhv_vop_attr_get(vp, kind == _ACL_TYPE_ACCESS ? 619 *error = xfs_attr_get(xfs_vtoi(vp),
620 kind == _ACL_TYPE_ACCESS ?
617 SGI_ACL_FILE : SGI_ACL_DEFAULT, 621 SGI_ACL_FILE : SGI_ACL_DEFAULT,
618 (char *)aclp, &len, flags, sys_cred); 622 (char *)aclp, &len, flags, sys_cred);
619 if (*error || (flags & ATTR_KERNOVAL)) 623 if (*error || (flags & ATTR_KERNOVAL))
@@ -651,9 +655,10 @@ xfs_acl_set_attr(
651 INT_SET(newace->ae_perm, ARCH_CONVERT, ace->ae_perm); 655 INT_SET(newace->ae_perm, ARCH_CONVERT, ace->ae_perm);
652 } 656 }
653 INT_SET(newacl->acl_cnt, ARCH_CONVERT, aclp->acl_cnt); 657 INT_SET(newacl->acl_cnt, ARCH_CONVERT, aclp->acl_cnt);
654 *error = bhv_vop_attr_set(vp, kind == _ACL_TYPE_ACCESS ? 658 *error = xfs_attr_set(xfs_vtoi(vp),
659 kind == _ACL_TYPE_ACCESS ?
655 SGI_ACL_FILE: SGI_ACL_DEFAULT, 660 SGI_ACL_FILE: SGI_ACL_DEFAULT,
656 (char *)newacl, len, ATTR_ROOT, sys_cred); 661 (char *)newacl, len, ATTR_ROOT);
657 _ACL_FREE(newacl); 662 _ACL_FREE(newacl);
658} 663}
659 664
@@ -675,7 +680,7 @@ xfs_acl_vtoacl(
675 if (!error) { 680 if (!error) {
676 /* Got the ACL, need the mode... */ 681 /* Got the ACL, need the mode... */
677 va.va_mask = XFS_AT_MODE; 682 va.va_mask = XFS_AT_MODE;
678 error = bhv_vop_getattr(vp, &va, 0, sys_cred); 683 error = xfs_getattr(xfs_vtoi(vp), &va, 0);
679 } 684 }
680 685
681 if (error) 686 if (error)
@@ -699,7 +704,7 @@ xfs_acl_vtoacl(
699int 704int
700xfs_acl_inherit( 705xfs_acl_inherit(
701 bhv_vnode_t *vp, 706 bhv_vnode_t *vp,
702 bhv_vattr_t *vap, 707 mode_t mode,
703 xfs_acl_t *pdaclp) 708 xfs_acl_t *pdaclp)
704{ 709{
705 xfs_acl_t *cacl; 710 xfs_acl_t *cacl;
@@ -727,7 +732,7 @@ xfs_acl_inherit(
727 return ENOMEM; 732 return ENOMEM;
728 733
729 memcpy(cacl, pdaclp, sizeof(xfs_acl_t)); 734 memcpy(cacl, pdaclp, sizeof(xfs_acl_t));
730 xfs_acl_filter_mode(vap->va_mode, cacl); 735 xfs_acl_filter_mode(mode, cacl);
731 xfs_acl_setmode(vp, cacl, &basicperms); 736 xfs_acl_setmode(vp, cacl, &basicperms);
732 737
733 /* 738 /*
@@ -773,7 +778,7 @@ xfs_acl_setmode(
773 * mode. The m:: bits take precedence over the g:: bits. 778 * mode. The m:: bits take precedence over the g:: bits.
774 */ 779 */
775 va.va_mask = XFS_AT_MODE; 780 va.va_mask = XFS_AT_MODE;
776 error = bhv_vop_getattr(vp, &va, 0, sys_cred); 781 error = xfs_getattr(xfs_vtoi(vp), &va, 0);
777 if (error) 782 if (error)
778 return error; 783 return error;
779 784
@@ -807,7 +812,7 @@ xfs_acl_setmode(
807 if (gap && nomask) 812 if (gap && nomask)
808 va.va_mode |= gap->ae_perm << 3; 813 va.va_mode |= gap->ae_perm << 3;
809 814
810 return bhv_vop_setattr(vp, &va, 0, sys_cred); 815 return xfs_setattr(xfs_vtoi(vp), &va, 0, sys_cred);
811} 816}
812 817
813/* 818/*