aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2008-02-04 20:13:24 -0500
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-02-07 02:22:38 -0500
commit4576758db5817a91b8974c696247d459dc653db2 (patch)
tree43b5b471510f0981ea2dc668ca7591a75831f111 /fs/xfs/xfs_inode.c
parentf6aa7f2184330262e1cb5f7802536e5346bd46a3 (diff)
[XFS] use generic_permission
Now that all direct caller of xfs_iaccess are gone we can kill xfs_iaccess and xfs_access and just use generic_permission with a check_acl callback. This is required for the per-mount read-only patchset in -mm to work properly with XFS. SGI-PV: 971186 SGI-Modid: xfs-linux-melb:xfs-kern:30370a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r--fs/xfs/xfs_inode.c63
1 files changed, 0 insertions, 63 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 75b636c14876..a550546a7083 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -3583,69 +3583,6 @@ xfs_iflush_all(
3583 XFS_MOUNT_IUNLOCK(mp); 3583 XFS_MOUNT_IUNLOCK(mp);
3584} 3584}
3585 3585
3586/*
3587 * xfs_iaccess: check accessibility of inode for mode.
3588 */
3589int
3590xfs_iaccess(
3591 xfs_inode_t *ip,
3592 mode_t mode,
3593 cred_t *cr)
3594{
3595 int error;
3596 mode_t orgmode = mode;
3597 struct inode *inode = vn_to_inode(XFS_ITOV(ip));
3598
3599 if (mode & S_IWUSR) {
3600 umode_t imode = inode->i_mode;
3601
3602 if (IS_RDONLY(inode) &&
3603 (S_ISREG(imode) || S_ISDIR(imode) || S_ISLNK(imode)))
3604 return XFS_ERROR(EROFS);
3605
3606 if (IS_IMMUTABLE(inode))
3607 return XFS_ERROR(EACCES);
3608 }
3609
3610 /*
3611 * If there's an Access Control List it's used instead of
3612 * the mode bits.
3613 */
3614 if ((error = _ACL_XFS_IACCESS(ip, mode, cr)) != -1)
3615 return error ? XFS_ERROR(error) : 0;
3616
3617 if (current_fsuid(cr) != ip->i_d.di_uid) {
3618 mode >>= 3;
3619 if (!in_group_p((gid_t)ip->i_d.di_gid))
3620 mode >>= 3;
3621 }
3622
3623 /*
3624 * If the DACs are ok we don't need any capability check.
3625 */
3626 if ((ip->i_d.di_mode & mode) == mode)
3627 return 0;
3628 /*
3629 * Read/write DACs are always overridable.
3630 * Executable DACs are overridable if at least one exec bit is set.
3631 */
3632 if (!(orgmode & S_IXUSR) ||
3633 (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode))
3634 if (capable_cred(cr, CAP_DAC_OVERRIDE))
3635 return 0;
3636
3637 if ((orgmode == S_IRUSR) ||
3638 (S_ISDIR(inode->i_mode) && (!(orgmode & S_IWUSR)))) {
3639 if (capable_cred(cr, CAP_DAC_READ_SEARCH))
3640 return 0;
3641#ifdef NOISE
3642 cmn_err(CE_NOTE, "Ick: mode=%o, orgmode=%o", mode, orgmode);
3643#endif /* NOISE */
3644 return XFS_ERROR(EACCES);
3645 }
3646 return XFS_ERROR(EACCES);
3647}
3648
3649#ifdef XFS_ILOCK_TRACE 3586#ifdef XFS_ILOCK_TRACE
3650ktrace_t *xfs_ilock_trace_buf; 3587ktrace_t *xfs_ilock_trace_buf;
3651 3588