]> git.ipfire.org Git - people/ms/linux.git/blobdiff - fs/xfs/xfs_iops.c
Merge branch 'for-6.0/dax' into libnvdimm-fixes
[people/ms/linux.git] / fs / xfs / xfs_iops.c
index 29f5b8b8aca69a0887fae8f961b208fcf308638e..45518b8c613c9a97fd364ccc7fead0fcf91f4771 100644 (file)
@@ -75,9 +75,8 @@ xfs_initxattrs(
  * these attrs can be journalled at inode creation time (along with the
  * inode, of course, such that log replay can't cause these to be lost).
  */
-
-STATIC int
-xfs_init_security(
+int
+xfs_inode_init_security(
        struct inode    *inode,
        struct inode    *dir,
        const struct qstr *qstr)
@@ -122,7 +121,7 @@ xfs_cleanup_inode(
 
        /* Oh, the horror.
         * If we can't add the ACL or we fail in
-        * xfs_init_security we must back out.
+        * xfs_inode_init_security we must back out.
         * ENOSPC can hit here, among other things.
         */
        xfs_dentry_to_name(&teardown, dentry);
@@ -208,7 +207,7 @@ xfs_generic_create(
 
        inode = VFS_I(ip);
 
-       error = xfs_init_security(inode, dir, &dentry->d_name);
+       error = xfs_inode_init_security(inode, dir, &dentry->d_name);
        if (unlikely(error))
                goto out_cleanup_inode;
 
@@ -424,7 +423,7 @@ xfs_vn_symlink(
 
        inode = VFS_I(cip);
 
-       error = xfs_init_security(inode, dir, &dentry->d_name);
+       error = xfs_inode_init_security(inode, dir, &dentry->d_name);
        if (unlikely(error))
                goto out_cleanup_inode;
 
@@ -667,13 +666,15 @@ xfs_setattr_nonsize(
                uint    qflags = 0;
 
                if ((mask & ATTR_UID) && XFS_IS_UQUOTA_ON(mp)) {
-                       uid = iattr->ia_uid;
+                       uid = from_vfsuid(mnt_userns, i_user_ns(inode),
+                                         iattr->ia_vfsuid);
                        qflags |= XFS_QMOPT_UQUOTA;
                } else {
                        uid = inode->i_uid;
                }
                if ((mask & ATTR_GID) && XFS_IS_GQUOTA_ON(mp)) {
-                       gid = iattr->ia_gid;
+                       gid = from_vfsgid(mnt_userns, i_user_ns(inode),
+                                         iattr->ia_vfsgid);
                        qflags |= XFS_QMOPT_GQUOTA;
                }  else {
                        gid = inode->i_gid;
@@ -704,13 +705,13 @@ xfs_setattr_nonsize(
         * didn't have the inode locked, inode's dquot(s) would have changed
         * also.
         */
-       if ((mask & ATTR_UID) && XFS_IS_UQUOTA_ON(mp) &&
-           !uid_eq(inode->i_uid, iattr->ia_uid)) {
+       if (XFS_IS_UQUOTA_ON(mp) &&
+           i_uid_needs_update(mnt_userns, iattr, inode)) {
                ASSERT(udqp);
                old_udqp = xfs_qm_vop_chown(tp, ip, &ip->i_udquot, udqp);
        }
-       if ((mask & ATTR_GID) && XFS_IS_GQUOTA_ON(mp) &&
-           !gid_eq(inode->i_gid, iattr->ia_gid)) {
+       if (XFS_IS_GQUOTA_ON(mp) &&
+           i_gid_needs_update(mnt_userns, iattr, inode)) {
                ASSERT(xfs_has_pquotino(mp) || !XFS_IS_PQUOTA_ON(mp));
                ASSERT(gdqp);
                old_gdqp = xfs_qm_vop_chown(tp, ip, &ip->i_gdquot, gdqp);
@@ -1280,7 +1281,7 @@ xfs_setup_inode(
         * If there is no attribute fork no ACL can exist on this inode,
         * and it can't have any file capabilities attached to it either.
         */
-       if (!XFS_IFORK_Q(ip)) {
+       if (!xfs_inode_has_attr_fork(ip)) {
                inode_has_no_xattr(inode);
                cache_no_acl(inode);
        }