aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_vnodeops.c
diff options
context:
space:
mode:
authorNathan Scott <nathans@sgi.com>2005-06-21 01:39:12 -0400
committerNathan Scott <nathans@sgi.com>2005-06-21 01:39:12 -0400
commit365ca83d509f77f2095976edb8d10ca6e9d86d58 (patch)
tree312ef7fdcb4f35f49d0b0432344779e32ca81cbd /fs/xfs/xfs_vnodeops.c
parentc8ad20ffeb592d66ea869c57f8c525a9d727c67b (diff)
[XFS] Add support for project quota inheritance, a merge of Glens changes.
SGI-PV: 932952 SGI-Modid: xfs-linux:xfs-kern:22806a Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r--fs/xfs/xfs_vnodeops.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 695978b27497..96dc18b73cf0 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -507,8 +507,6 @@ xfs_setattr(
507 * that the group ID supplied to the chown() function 507 * that the group ID supplied to the chown() function
508 * shall be equal to either the group ID or one of the 508 * shall be equal to either the group ID or one of the
509 * supplementary group IDs of the calling process. 509 * supplementary group IDs of the calling process.
510 *
511 * XXX: How does restricted_chown affect projid?
512 */ 510 */
513 if (restricted_chown && 511 if (restricted_chown &&
514 (iuid != uid || (igid != gid && 512 (iuid != uid || (igid != gid &&
@@ -860,6 +858,8 @@ xfs_setattr(
860 di_flags |= XFS_DIFLAG_NOATIME; 858 di_flags |= XFS_DIFLAG_NOATIME;
861 if (vap->va_xflags & XFS_XFLAG_NODUMP) 859 if (vap->va_xflags & XFS_XFLAG_NODUMP)
862 di_flags |= XFS_DIFLAG_NODUMP; 860 di_flags |= XFS_DIFLAG_NODUMP;
861 if (vap->va_xflags & XFS_XFLAG_PROJINHERIT)
862 di_flags |= XFS_DIFLAG_PROJINHERIT;
863 if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) { 863 if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) {
864 if (vap->va_xflags & XFS_XFLAG_RTINHERIT) 864 if (vap->va_xflags & XFS_XFLAG_RTINHERIT)
865 di_flags |= XFS_DIFLAG_RTINHERIT; 865 di_flags |= XFS_DIFLAG_RTINHERIT;
@@ -1915,7 +1915,9 @@ xfs_create(
1915 /* Return through std_return after this point. */ 1915 /* Return through std_return after this point. */
1916 1916
1917 udqp = gdqp = NULL; 1917 udqp = gdqp = NULL;
1918 if (vap->va_mask & XFS_AT_PROJID) 1918 if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
1919 prid = dp->i_d.di_projid;
1920 else if (vap->va_mask & XFS_AT_PROJID)
1919 prid = (xfs_prid_t)vap->va_projid; 1921 prid = (xfs_prid_t)vap->va_projid;
1920 else 1922 else
1921 prid = (xfs_prid_t)dfltprid; 1923 prid = (xfs_prid_t)dfltprid;
@@ -2621,17 +2623,7 @@ xfs_link(
2621 if (src_vp->v_type == VDIR) 2623 if (src_vp->v_type == VDIR)
2622 return XFS_ERROR(EPERM); 2624 return XFS_ERROR(EPERM);
2623 2625
2624 /*
2625 * For now, manually find the XFS behavior descriptor for
2626 * the source vnode. If it doesn't exist then something
2627 * is wrong and we should just return an error.
2628 * Eventually we need to figure out how link is going to
2629 * work in the face of stacked vnodes.
2630 */
2631 src_bdp = vn_bhv_lookup_unlocked(VN_BHV_HEAD(src_vp), &xfs_vnodeops); 2626 src_bdp = vn_bhv_lookup_unlocked(VN_BHV_HEAD(src_vp), &xfs_vnodeops);
2632 if (src_bdp == NULL) {
2633 return XFS_ERROR(EXDEV);
2634 }
2635 sip = XFS_BHVTOI(src_bdp); 2627 sip = XFS_BHVTOI(src_bdp);
2636 tdp = XFS_BHVTOI(target_dir_bdp); 2628 tdp = XFS_BHVTOI(target_dir_bdp);
2637 mp = tdp->i_mount; 2629 mp = tdp->i_mount;
@@ -2698,6 +2690,17 @@ xfs_link(
2698 goto error_return; 2690 goto error_return;
2699 } 2691 }
2700 2692
2693 /*
2694 * If we are using project inheritance, we only allow hard link
2695 * creation in our tree when the project IDs are the same; else
2696 * the tree quota mechanism could be circumvented.
2697 */
2698 if (unlikely((tdp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) &&
2699 (tdp->i_d.di_projid != sip->i_d.di_projid))) {
2700 error = XFS_ERROR(EPERM);
2701 goto error_return;
2702 }
2703
2701 if (resblks == 0 && 2704 if (resblks == 0 &&
2702 (error = XFS_DIR_CANENTER(mp, tp, tdp, target_name, 2705 (error = XFS_DIR_CANENTER(mp, tp, tdp, target_name,
2703 target_namelen))) 2706 target_namelen)))
@@ -2820,7 +2823,9 @@ xfs_mkdir(
2820 2823
2821 mp = dp->i_mount; 2824 mp = dp->i_mount;
2822 udqp = gdqp = NULL; 2825 udqp = gdqp = NULL;
2823 if (vap->va_mask & XFS_AT_PROJID) 2826 if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
2827 prid = dp->i_d.di_projid;
2828 else if (vap->va_mask & XFS_AT_PROJID)
2824 prid = (xfs_prid_t)vap->va_projid; 2829 prid = (xfs_prid_t)vap->va_projid;
2825 else 2830 else
2826 prid = (xfs_prid_t)dfltprid; 2831 prid = (xfs_prid_t)dfltprid;
@@ -3374,7 +3379,9 @@ xfs_symlink(
3374 /* Return through std_return after this point. */ 3379 /* Return through std_return after this point. */
3375 3380
3376 udqp = gdqp = NULL; 3381 udqp = gdqp = NULL;
3377 if (vap->va_mask & XFS_AT_PROJID) 3382 if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
3383 prid = dp->i_d.di_projid;
3384 else if (vap->va_mask & XFS_AT_PROJID)
3378 prid = (xfs_prid_t)vap->va_projid; 3385 prid = (xfs_prid_t)vap->va_projid;
3379 else 3386 else
3380 prid = (xfs_prid_t)dfltprid; 3387 prid = (xfs_prid_t)dfltprid;