diff options
author | Dwight Engen <dwight.engen@oracle.com> | 2013-08-15 14:08:01 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-08-15 15:22:40 -0400 |
commit | 7aab1b28879d2280c9a0e50000e4ae153cfac55a (patch) | |
tree | e30dfe89a43849a9eecece13e721e89528ff13ce /fs | |
parent | fd5e2aa8653665ae1cc60f7aca1069abdbcad3f6 (diff) |
xfs: convert kuid_t to/from uid_t for internal structures
Use uint32 from init_user_ns for xfs internal uid/gid
representation in xfs_icdinode, xfs_dqid_t.
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Gao feng <gaofeng@cn.fujitsu.com>
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/xfs_inode.c | 9 | ||||
-rw-r--r-- | fs/xfs/xfs_iops.c | 38 | ||||
-rw-r--r-- | fs/xfs/xfs_qm.c | 10 | ||||
-rw-r--r-- | fs/xfs/xfs_quota.h | 11 | ||||
-rw-r--r-- | fs/xfs/xfs_symlink.c | 7 |
5 files changed, 41 insertions, 34 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 2f41a1a2f888..8750cdb6e512 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -690,8 +690,8 @@ xfs_ialloc( | |||
690 | ip->i_d.di_onlink = 0; | 690 | ip->i_d.di_onlink = 0; |
691 | ip->i_d.di_nlink = nlink; | 691 | ip->i_d.di_nlink = nlink; |
692 | ASSERT(ip->i_d.di_nlink == nlink); | 692 | ASSERT(ip->i_d.di_nlink == nlink); |
693 | ip->i_d.di_uid = current_fsuid(); | 693 | ip->i_d.di_uid = xfs_kuid_to_uid(current_fsuid()); |
694 | ip->i_d.di_gid = current_fsgid(); | 694 | ip->i_d.di_gid = xfs_kgid_to_gid(current_fsgid()); |
695 | xfs_set_projid(ip, prid); | 695 | xfs_set_projid(ip, prid); |
696 | memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); | 696 | memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); |
697 | 697 | ||
@@ -730,7 +730,7 @@ xfs_ialloc( | |||
730 | */ | 730 | */ |
731 | if ((irix_sgid_inherit) && | 731 | if ((irix_sgid_inherit) && |
732 | (ip->i_d.di_mode & S_ISGID) && | 732 | (ip->i_d.di_mode & S_ISGID) && |
733 | (!in_group_p((gid_t)ip->i_d.di_gid))) { | 733 | (!in_group_p(xfs_gid_to_kgid(ip->i_d.di_gid)))) { |
734 | ip->i_d.di_mode &= ~S_ISGID; | 734 | ip->i_d.di_mode &= ~S_ISGID; |
735 | } | 735 | } |
736 | 736 | ||
@@ -1178,7 +1178,8 @@ xfs_create( | |||
1178 | /* | 1178 | /* |
1179 | * Make sure that we have allocated dquot(s) on disk. | 1179 | * Make sure that we have allocated dquot(s) on disk. |
1180 | */ | 1180 | */ |
1181 | error = xfs_qm_vop_dqalloc(dp, current_fsuid(), current_fsgid(), prid, | 1181 | error = xfs_qm_vop_dqalloc(dp, xfs_kuid_to_uid(current_fsuid()), |
1182 | xfs_kgid_to_gid(current_fsgid()), prid, | ||
1182 | XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, | 1183 | XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, |
1183 | &udqp, &gdqp, &pdqp); | 1184 | &udqp, &gdqp, &pdqp); |
1184 | if (error) | 1185 | if (error) |
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 82c5a5d8677d..6d7e9e2d7651 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c | |||
@@ -421,8 +421,8 @@ xfs_vn_getattr( | |||
421 | stat->dev = inode->i_sb->s_dev; | 421 | stat->dev = inode->i_sb->s_dev; |
422 | stat->mode = ip->i_d.di_mode; | 422 | stat->mode = ip->i_d.di_mode; |
423 | stat->nlink = ip->i_d.di_nlink; | 423 | stat->nlink = ip->i_d.di_nlink; |
424 | stat->uid = ip->i_d.di_uid; | 424 | stat->uid = inode->i_uid; |
425 | stat->gid = ip->i_d.di_gid; | 425 | stat->gid = inode->i_gid; |
426 | stat->ino = ip->i_ino; | 426 | stat->ino = ip->i_ino; |
427 | stat->atime = inode->i_atime; | 427 | stat->atime = inode->i_atime; |
428 | stat->mtime = inode->i_mtime; | 428 | stat->mtime = inode->i_mtime; |
@@ -486,8 +486,8 @@ xfs_setattr_nonsize( | |||
486 | int mask = iattr->ia_valid; | 486 | int mask = iattr->ia_valid; |
487 | xfs_trans_t *tp; | 487 | xfs_trans_t *tp; |
488 | int error; | 488 | int error; |
489 | uid_t uid = 0, iuid = 0; | 489 | kuid_t uid = GLOBAL_ROOT_UID, iuid = GLOBAL_ROOT_UID; |
490 | gid_t gid = 0, igid = 0; | 490 | kgid_t gid = GLOBAL_ROOT_GID, igid = GLOBAL_ROOT_GID; |
491 | struct xfs_dquot *udqp = NULL, *gdqp = NULL; | 491 | struct xfs_dquot *udqp = NULL, *gdqp = NULL; |
492 | struct xfs_dquot *olddquot1 = NULL, *olddquot2 = NULL; | 492 | struct xfs_dquot *olddquot1 = NULL, *olddquot2 = NULL; |
493 | 493 | ||
@@ -523,13 +523,13 @@ xfs_setattr_nonsize( | |||
523 | uid = iattr->ia_uid; | 523 | uid = iattr->ia_uid; |
524 | qflags |= XFS_QMOPT_UQUOTA; | 524 | qflags |= XFS_QMOPT_UQUOTA; |
525 | } else { | 525 | } else { |
526 | uid = ip->i_d.di_uid; | 526 | uid = inode->i_uid; |
527 | } | 527 | } |
528 | if ((mask & ATTR_GID) && XFS_IS_GQUOTA_ON(mp)) { | 528 | if ((mask & ATTR_GID) && XFS_IS_GQUOTA_ON(mp)) { |
529 | gid = iattr->ia_gid; | 529 | gid = iattr->ia_gid; |
530 | qflags |= XFS_QMOPT_GQUOTA; | 530 | qflags |= XFS_QMOPT_GQUOTA; |
531 | } else { | 531 | } else { |
532 | gid = ip->i_d.di_gid; | 532 | gid = inode->i_gid; |
533 | } | 533 | } |
534 | 534 | ||
535 | /* | 535 | /* |
@@ -539,8 +539,10 @@ xfs_setattr_nonsize( | |||
539 | */ | 539 | */ |
540 | ASSERT(udqp == NULL); | 540 | ASSERT(udqp == NULL); |
541 | ASSERT(gdqp == NULL); | 541 | ASSERT(gdqp == NULL); |
542 | error = xfs_qm_vop_dqalloc(ip, uid, gid, xfs_get_projid(ip), | 542 | error = xfs_qm_vop_dqalloc(ip, xfs_kuid_to_uid(uid), |
543 | qflags, &udqp, &gdqp, NULL); | 543 | xfs_kgid_to_gid(gid), |
544 | xfs_get_projid(ip), | ||
545 | qflags, &udqp, &gdqp, NULL); | ||
544 | if (error) | 546 | if (error) |
545 | return error; | 547 | return error; |
546 | } | 548 | } |
@@ -562,8 +564,8 @@ xfs_setattr_nonsize( | |||
562 | * while we didn't have the inode locked, inode's dquot(s) | 564 | * while we didn't have the inode locked, inode's dquot(s) |
563 | * would have changed also. | 565 | * would have changed also. |
564 | */ | 566 | */ |
565 | iuid = ip->i_d.di_uid; | 567 | iuid = inode->i_uid; |
566 | igid = ip->i_d.di_gid; | 568 | igid = inode->i_gid; |
567 | gid = (mask & ATTR_GID) ? iattr->ia_gid : igid; | 569 | gid = (mask & ATTR_GID) ? iattr->ia_gid : igid; |
568 | uid = (mask & ATTR_UID) ? iattr->ia_uid : iuid; | 570 | uid = (mask & ATTR_UID) ? iattr->ia_uid : iuid; |
569 | 571 | ||
@@ -572,8 +574,8 @@ xfs_setattr_nonsize( | |||
572 | * going to change. | 574 | * going to change. |
573 | */ | 575 | */ |
574 | if (XFS_IS_QUOTA_RUNNING(mp) && | 576 | if (XFS_IS_QUOTA_RUNNING(mp) && |
575 | ((XFS_IS_UQUOTA_ON(mp) && iuid != uid) || | 577 | ((XFS_IS_UQUOTA_ON(mp) && !uid_eq(iuid, uid)) || |
576 | (XFS_IS_GQUOTA_ON(mp) && igid != gid))) { | 578 | (XFS_IS_GQUOTA_ON(mp) && !gid_eq(igid, gid)))) { |
577 | ASSERT(tp); | 579 | ASSERT(tp); |
578 | error = xfs_qm_vop_chown_reserve(tp, ip, udqp, gdqp, | 580 | error = xfs_qm_vop_chown_reserve(tp, ip, udqp, gdqp, |
579 | NULL, capable(CAP_FOWNER) ? | 581 | NULL, capable(CAP_FOWNER) ? |
@@ -603,17 +605,17 @@ xfs_setattr_nonsize( | |||
603 | * Change the ownerships and register quota modifications | 605 | * Change the ownerships and register quota modifications |
604 | * in the transaction. | 606 | * in the transaction. |
605 | */ | 607 | */ |
606 | if (iuid != uid) { | 608 | if (!uid_eq(iuid, uid)) { |
607 | if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_UQUOTA_ON(mp)) { | 609 | if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_UQUOTA_ON(mp)) { |
608 | ASSERT(mask & ATTR_UID); | 610 | ASSERT(mask & ATTR_UID); |
609 | ASSERT(udqp); | 611 | ASSERT(udqp); |
610 | olddquot1 = xfs_qm_vop_chown(tp, ip, | 612 | olddquot1 = xfs_qm_vop_chown(tp, ip, |
611 | &ip->i_udquot, udqp); | 613 | &ip->i_udquot, udqp); |
612 | } | 614 | } |
613 | ip->i_d.di_uid = uid; | 615 | ip->i_d.di_uid = xfs_kuid_to_uid(uid); |
614 | inode->i_uid = uid; | 616 | inode->i_uid = uid; |
615 | } | 617 | } |
616 | if (igid != gid) { | 618 | if (!gid_eq(igid, gid)) { |
617 | if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_GQUOTA_ON(mp)) { | 619 | if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_GQUOTA_ON(mp)) { |
618 | ASSERT(!XFS_IS_PQUOTA_ON(mp)); | 620 | ASSERT(!XFS_IS_PQUOTA_ON(mp)); |
619 | ASSERT(mask & ATTR_GID); | 621 | ASSERT(mask & ATTR_GID); |
@@ -621,7 +623,7 @@ xfs_setattr_nonsize( | |||
621 | olddquot2 = xfs_qm_vop_chown(tp, ip, | 623 | olddquot2 = xfs_qm_vop_chown(tp, ip, |
622 | &ip->i_gdquot, gdqp); | 624 | &ip->i_gdquot, gdqp); |
623 | } | 625 | } |
624 | ip->i_d.di_gid = gid; | 626 | ip->i_d.di_gid = xfs_kgid_to_gid(gid); |
625 | inode->i_gid = gid; | 627 | inode->i_gid = gid; |
626 | } | 628 | } |
627 | } | 629 | } |
@@ -1172,8 +1174,8 @@ xfs_setup_inode( | |||
1172 | 1174 | ||
1173 | inode->i_mode = ip->i_d.di_mode; | 1175 | inode->i_mode = ip->i_d.di_mode; |
1174 | set_nlink(inode, ip->i_d.di_nlink); | 1176 | set_nlink(inode, ip->i_d.di_nlink); |
1175 | inode->i_uid = ip->i_d.di_uid; | 1177 | inode->i_uid = xfs_uid_to_kuid(ip->i_d.di_uid); |
1176 | inode->i_gid = ip->i_d.di_gid; | 1178 | inode->i_gid = xfs_gid_to_kgid(ip->i_d.di_gid); |
1177 | 1179 | ||
1178 | switch (inode->i_mode & S_IFMT) { | 1180 | switch (inode->i_mode & S_IFMT) { |
1179 | case S_IFBLK: | 1181 | case S_IFBLK: |
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c index 479c933d7cdf..6218a0aeeeea 100644 --- a/fs/xfs/xfs_qm.c +++ b/fs/xfs/xfs_qm.c | |||
@@ -1767,8 +1767,8 @@ xfs_qm_write_sb_changes( | |||
1767 | int | 1767 | int |
1768 | xfs_qm_vop_dqalloc( | 1768 | xfs_qm_vop_dqalloc( |
1769 | struct xfs_inode *ip, | 1769 | struct xfs_inode *ip, |
1770 | uid_t uid, | 1770 | xfs_dqid_t uid, |
1771 | gid_t gid, | 1771 | xfs_dqid_t gid, |
1772 | prid_t prid, | 1772 | prid_t prid, |
1773 | uint flags, | 1773 | uint flags, |
1774 | struct xfs_dquot **O_udqpp, | 1774 | struct xfs_dquot **O_udqpp, |
@@ -1815,7 +1815,7 @@ xfs_qm_vop_dqalloc( | |||
1815 | * holding ilock. | 1815 | * holding ilock. |
1816 | */ | 1816 | */ |
1817 | xfs_iunlock(ip, lockflags); | 1817 | xfs_iunlock(ip, lockflags); |
1818 | error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t) uid, | 1818 | error = xfs_qm_dqget(mp, NULL, uid, |
1819 | XFS_DQ_USER, | 1819 | XFS_DQ_USER, |
1820 | XFS_QMOPT_DQALLOC | | 1820 | XFS_QMOPT_DQALLOC | |
1821 | XFS_QMOPT_DOWARN, | 1821 | XFS_QMOPT_DOWARN, |
@@ -1842,7 +1842,7 @@ xfs_qm_vop_dqalloc( | |||
1842 | if ((flags & XFS_QMOPT_GQUOTA) && XFS_IS_GQUOTA_ON(mp)) { | 1842 | if ((flags & XFS_QMOPT_GQUOTA) && XFS_IS_GQUOTA_ON(mp)) { |
1843 | if (ip->i_d.di_gid != gid) { | 1843 | if (ip->i_d.di_gid != gid) { |
1844 | xfs_iunlock(ip, lockflags); | 1844 | xfs_iunlock(ip, lockflags); |
1845 | error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t)gid, | 1845 | error = xfs_qm_dqget(mp, NULL, gid, |
1846 | XFS_DQ_GROUP, | 1846 | XFS_DQ_GROUP, |
1847 | XFS_QMOPT_DQALLOC | | 1847 | XFS_QMOPT_DQALLOC | |
1848 | XFS_QMOPT_DOWARN, | 1848 | XFS_QMOPT_DOWARN, |
@@ -1976,7 +1976,7 @@ xfs_qm_vop_chown_reserve( | |||
1976 | XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS; | 1976 | XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS; |
1977 | 1977 | ||
1978 | if (XFS_IS_UQUOTA_ON(mp) && udqp && | 1978 | if (XFS_IS_UQUOTA_ON(mp) && udqp && |
1979 | ip->i_d.di_uid != (uid_t)be32_to_cpu(udqp->q_core.d_id)) { | 1979 | ip->i_d.di_uid != be32_to_cpu(udqp->q_core.d_id)) { |
1980 | udq_delblks = udqp; | 1980 | udq_delblks = udqp; |
1981 | /* | 1981 | /* |
1982 | * If there are delayed allocation blocks, then we have to | 1982 | * If there are delayed allocation blocks, then we have to |
diff --git a/fs/xfs/xfs_quota.h b/fs/xfs/xfs_quota.h index fc2fed67a58d..66522da04d6e 100644 --- a/fs/xfs/xfs_quota.h +++ b/fs/xfs/xfs_quota.h | |||
@@ -87,8 +87,9 @@ extern int xfs_trans_reserve_quota_bydquots(struct xfs_trans *, | |||
87 | struct xfs_mount *, struct xfs_dquot *, | 87 | struct xfs_mount *, struct xfs_dquot *, |
88 | struct xfs_dquot *, struct xfs_dquot *, long, long, uint); | 88 | struct xfs_dquot *, struct xfs_dquot *, long, long, uint); |
89 | 89 | ||
90 | extern int xfs_qm_vop_dqalloc(struct xfs_inode *, uid_t, gid_t, prid_t, uint, | 90 | extern int xfs_qm_vop_dqalloc(struct xfs_inode *, xfs_dqid_t, xfs_dqid_t, |
91 | struct xfs_dquot **, struct xfs_dquot **, struct xfs_dquot **); | 91 | prid_t, uint, struct xfs_dquot **, struct xfs_dquot **, |
92 | struct xfs_dquot **); | ||
92 | extern void xfs_qm_vop_create_dqattach(struct xfs_trans *, struct xfs_inode *, | 93 | extern void xfs_qm_vop_create_dqattach(struct xfs_trans *, struct xfs_inode *, |
93 | struct xfs_dquot *, struct xfs_dquot *, struct xfs_dquot *); | 94 | struct xfs_dquot *, struct xfs_dquot *, struct xfs_dquot *); |
94 | extern int xfs_qm_vop_rename_dqattach(struct xfs_inode **); | 95 | extern int xfs_qm_vop_rename_dqattach(struct xfs_inode **); |
@@ -109,9 +110,9 @@ extern void xfs_qm_unmount_quotas(struct xfs_mount *); | |||
109 | 110 | ||
110 | #else | 111 | #else |
111 | static inline int | 112 | static inline int |
112 | xfs_qm_vop_dqalloc(struct xfs_inode *ip, uid_t uid, gid_t gid, prid_t prid, | 113 | xfs_qm_vop_dqalloc(struct xfs_inode *ip, xfs_dqid_t uid, xfs_dqid_t gid, |
113 | uint flags, struct xfs_dquot **udqp, struct xfs_dquot **gdqp, | 114 | prid_t prid, uint flags, struct xfs_dquot **udqp, |
114 | struct xfs_dquot **pdqp) | 115 | struct xfs_dquot **gdqp, struct xfs_dquot **pdqp) |
115 | { | 116 | { |
116 | *udqp = NULL; | 117 | *udqp = NULL; |
117 | *gdqp = NULL; | 118 | *gdqp = NULL; |
diff --git a/fs/xfs/xfs_symlink.c b/fs/xfs/xfs_symlink.c index 7676fe3d706d..2f2a7c005be2 100644 --- a/fs/xfs/xfs_symlink.c +++ b/fs/xfs/xfs_symlink.c | |||
@@ -215,8 +215,11 @@ xfs_symlink( | |||
215 | /* | 215 | /* |
216 | * Make sure that we have allocated dquot(s) on disk. | 216 | * Make sure that we have allocated dquot(s) on disk. |
217 | */ | 217 | */ |
218 | error = xfs_qm_vop_dqalloc(dp, current_fsuid(), current_fsgid(), prid, | 218 | error = xfs_qm_vop_dqalloc(dp, |
219 | XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp, &pdqp); | 219 | xfs_kuid_to_uid(current_fsuid()), |
220 | xfs_kgid_to_gid(current_fsgid()), prid, | ||
221 | XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, | ||
222 | &udqp, &gdqp, &pdqp); | ||
220 | if (error) | 223 | if (error) |
221 | goto std_return; | 224 | goto std_return; |
222 | 225 | ||