diff options
author | Christoph Hellwig <hch@infradead.org> | 2008-04-22 03:33:33 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-04-29 01:53:16 -0400 |
commit | 4e5dbb3498e74514b9936d691413afc55fb84ea9 (patch) | |
tree | 1ed8b98d33e243f404f9c7fa28c4b0e2a6016508 /fs/xfs/xfs_acl.c | |
parent | 42173f6860af7e016a950a9a19a66679cfc46d98 (diff) |
[XFS] kill xfs_getattr
It's currently used by the ACL code to read di_mode/di_uid, but these are
simple 32bit scalar values we can just read directly without locking.
SGI-PV: 976035
SGI-Modid: xfs-linux-melb:xfs-kern:30897a
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_acl.c')
-rw-r--r-- | fs/xfs/xfs_acl.c | 40 |
1 files changed, 7 insertions, 33 deletions
diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c index b1275cc45617..796e76ef2713 100644 --- a/fs/xfs/xfs_acl.c +++ b/fs/xfs/xfs_acl.c | |||
@@ -238,15 +238,8 @@ xfs_acl_vget( | |||
238 | error = EINVAL; | 238 | error = EINVAL; |
239 | goto out; | 239 | goto out; |
240 | } | 240 | } |
241 | if (kind == _ACL_TYPE_ACCESS) { | 241 | if (kind == _ACL_TYPE_ACCESS) |
242 | bhv_vattr_t va; | 242 | xfs_acl_sync_mode(xfs_vtoi(vp)->i_d.di_mode, xfs_acl); |
243 | |||
244 | va.va_mask = XFS_AT_MODE; | ||
245 | error = xfs_getattr(xfs_vtoi(vp), &va, 0); | ||
246 | if (error) | ||
247 | goto out; | ||
248 | xfs_acl_sync_mode(va.va_mode, xfs_acl); | ||
249 | } | ||
250 | error = -posix_acl_xfs_to_xattr(xfs_acl, ext_acl, size); | 243 | error = -posix_acl_xfs_to_xattr(xfs_acl, ext_acl, size); |
251 | } | 244 | } |
252 | out: | 245 | out: |
@@ -373,23 +366,15 @@ xfs_acl_allow_set( | |||
373 | bhv_vnode_t *vp, | 366 | bhv_vnode_t *vp, |
374 | int kind) | 367 | int kind) |
375 | { | 368 | { |
376 | xfs_inode_t *ip = xfs_vtoi(vp); | ||
377 | bhv_vattr_t va; | ||
378 | int error; | ||
379 | |||
380 | if (vp->i_flags & (S_IMMUTABLE|S_APPEND)) | 369 | if (vp->i_flags & (S_IMMUTABLE|S_APPEND)) |
381 | return EPERM; | 370 | return EPERM; |
382 | if (kind == _ACL_TYPE_DEFAULT && !S_ISDIR(vp->i_mode)) | 371 | if (kind == _ACL_TYPE_DEFAULT && !S_ISDIR(vp->i_mode)) |
383 | return ENOTDIR; | 372 | return ENOTDIR; |
384 | if (vp->i_sb->s_flags & MS_RDONLY) | 373 | if (vp->i_sb->s_flags & MS_RDONLY) |
385 | return EROFS; | 374 | return EROFS; |
386 | va.va_mask = XFS_AT_UID; | 375 | if (xfs_vtoi(vp)->i_d.di_uid != current->fsuid && !capable(CAP_FOWNER)) |
387 | error = xfs_getattr(ip, &va, 0); | ||
388 | if (error) | ||
389 | return error; | ||
390 | if (va.va_uid != current->fsuid && !capable(CAP_FOWNER)) | ||
391 | return EPERM; | 376 | return EPERM; |
392 | return error; | 377 | return 0; |
393 | } | 378 | } |
394 | 379 | ||
395 | /* | 380 | /* |
@@ -643,7 +628,6 @@ xfs_acl_vtoacl( | |||
643 | xfs_acl_t *access_acl, | 628 | xfs_acl_t *access_acl, |
644 | xfs_acl_t *default_acl) | 629 | xfs_acl_t *default_acl) |
645 | { | 630 | { |
646 | bhv_vattr_t va; | ||
647 | int error = 0; | 631 | int error = 0; |
648 | 632 | ||
649 | if (access_acl) { | 633 | if (access_acl) { |
@@ -652,16 +636,10 @@ xfs_acl_vtoacl( | |||
652 | * be obtained for some reason, invalidate the access ACL. | 636 | * be obtained for some reason, invalidate the access ACL. |
653 | */ | 637 | */ |
654 | xfs_acl_get_attr(vp, access_acl, _ACL_TYPE_ACCESS, 0, &error); | 638 | xfs_acl_get_attr(vp, access_acl, _ACL_TYPE_ACCESS, 0, &error); |
655 | if (!error) { | ||
656 | /* Got the ACL, need the mode... */ | ||
657 | va.va_mask = XFS_AT_MODE; | ||
658 | error = xfs_getattr(xfs_vtoi(vp), &va, 0); | ||
659 | } | ||
660 | |||
661 | if (error) | 639 | if (error) |
662 | access_acl->acl_cnt = XFS_ACL_NOT_PRESENT; | 640 | access_acl->acl_cnt = XFS_ACL_NOT_PRESENT; |
663 | else /* We have a good ACL and the file mode, synchronize. */ | 641 | else /* We have a good ACL and the file mode, synchronize. */ |
664 | xfs_acl_sync_mode(va.va_mode, access_acl); | 642 | xfs_acl_sync_mode(xfs_vtoi(vp)->i_d.di_mode, access_acl); |
665 | } | 643 | } |
666 | 644 | ||
667 | if (default_acl) { | 645 | if (default_acl) { |
@@ -744,7 +722,7 @@ xfs_acl_setmode( | |||
744 | bhv_vattr_t va; | 722 | bhv_vattr_t va; |
745 | xfs_acl_entry_t *ap; | 723 | xfs_acl_entry_t *ap; |
746 | xfs_acl_entry_t *gap = NULL; | 724 | xfs_acl_entry_t *gap = NULL; |
747 | int i, error, nomask = 1; | 725 | int i, nomask = 1; |
748 | 726 | ||
749 | *basicperms = 1; | 727 | *basicperms = 1; |
750 | 728 | ||
@@ -756,11 +734,7 @@ xfs_acl_setmode( | |||
756 | * mode. The m:: bits take precedence over the g:: bits. | 734 | * mode. The m:: bits take precedence over the g:: bits. |
757 | */ | 735 | */ |
758 | va.va_mask = XFS_AT_MODE; | 736 | va.va_mask = XFS_AT_MODE; |
759 | error = xfs_getattr(xfs_vtoi(vp), &va, 0); | 737 | va.va_mode = xfs_vtoi(vp)->i_d.di_mode; |
760 | if (error) | ||
761 | return error; | ||
762 | |||
763 | va.va_mask = XFS_AT_MODE; | ||
764 | va.va_mode &= ~(S_IRWXU|S_IRWXG|S_IRWXO); | 738 | va.va_mode &= ~(S_IRWXU|S_IRWXG|S_IRWXO); |
765 | ap = acl->acl_entry; | 739 | ap = acl->acl_entry; |
766 | for (i = 0; i < acl->acl_cnt; ++i) { | 740 | for (i = 0; i < acl->acl_cnt; ++i) { |