xfs
[Top] [All Lists]

[PATCH 06/14] xfs: Use kuids and kgids in xfs_setattr_nonsize

To: <linux-fsdevel@xxxxxxxxxxxxxxx>
Subject: [PATCH 06/14] xfs: Use kuids and kgids in xfs_setattr_nonsize
From: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>
Date: Wed, 13 Mar 2013 15:23:07 -0700
Cc: Linux Containers <containers@xxxxxxxxxxxxxxxxxxxxxxxxxx>, "Serge E. Hallyn" <serge@xxxxxxxxxx>, xfs@xxxxxxxxxxx, Ben Myers <bpm@xxxxxxx>, Alex Elder <elder@xxxxxxxxxx>, Dave Chinner <david@xxxxxxxxxxxxx>, "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1363213395-10988-1-git-send-email-ebiederm@xxxxxxxxxxxx>
References: <87boan3prc.fsf@xxxxxxxxxxxx> <1363213395-10988-1-git-send-email-ebiederm@xxxxxxxxxxxx>
From: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>

Cc: Ben Myers <bpm@xxxxxxx>
Cc: Alex Elder <elder@xxxxxxxxxx>
Cc: Dave Chinner <david@xxxxxxxxxxxxx>
Signed-off-by: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>
---
 fs/xfs/xfs_iops.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index a69ddfd..e9dcf48 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -466,8 +466,8 @@ xfs_setattr_nonsize(
        int                     mask = iattr->ia_valid;
        xfs_trans_t             *tp;
        int                     error;
-       uid_t                   uid = 0, iuid = 0;
-       gid_t                   gid = 0, igid = 0;
+       kuid_t                  uid = GLOBAL_ROOT_UID, iuid = GLOBAL_ROOT_UID;
+       kgid_t                  gid = GLOBAL_ROOT_GID, igid = GLOBAL_ROOT_GID;
        struct xfs_dquot        *udqp = NULL, *gdqp = NULL;
        struct xfs_dquot        *olddquot1 = NULL, *olddquot2 = NULL;
 
@@ -549,8 +549,8 @@ xfs_setattr_nonsize(
                 * going to change.
                 */
                if (XFS_IS_QUOTA_RUNNING(mp) &&
-                   ((XFS_IS_UQUOTA_ON(mp) && iuid != uid) ||
-                    (XFS_IS_GQUOTA_ON(mp) && igid != gid))) {
+                   ((XFS_IS_UQUOTA_ON(mp) && !uid_eq(iuid, uid)) ||
+                    (XFS_IS_GQUOTA_ON(mp) && !gid_eq(igid, gid)))) {
                        ASSERT(tp);
                        error = xfs_qm_vop_chown_reserve(tp, ip, udqp, gdqp,
                                                capable(CAP_FOWNER) ?
@@ -580,7 +580,7 @@ xfs_setattr_nonsize(
                 * Change the ownerships and register quota modifications
                 * in the transaction.
                 */
-               if (iuid != uid) {
+               if (!uid_eq(iuid, uid)) {
                        if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_UQUOTA_ON(mp)) {
                                ASSERT(mask & ATTR_UID);
                                ASSERT(udqp);
@@ -590,7 +590,7 @@ xfs_setattr_nonsize(
                        ip->i_d.di_uid = uid;
                        inode->i_uid = uid;
                }
-               if (igid != gid) {
+               if (!gid_eq(igid, gid)) {
                        if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_GQUOTA_ON(mp)) {
                                ASSERT(!XFS_IS_PQUOTA_ON(mp));
                                ASSERT(mask & ATTR_GID);
-- 
1.7.5.4

<Prev in Thread] Current Thread [Next in Thread>