aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_iops.c
diff options
context:
space:
mode:
authorDwight Engen <dwight.engen@oracle.com>2013-08-15 14:08:01 -0400
committerBen Myers <bpm@sgi.com>2013-08-15 15:22:40 -0400
commit7aab1b28879d2280c9a0e50000e4ae153cfac55a (patch)
treee30dfe89a43849a9eecece13e721e89528ff13ce /fs/xfs/xfs_iops.c
parentfd5e2aa8653665ae1cc60f7aca1069abdbcad3f6 (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/xfs/xfs_iops.c')
-rw-r--r--fs/xfs/xfs_iops.c38
1 files changed, 20 insertions, 18 deletions
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: