xfs_inode.c (e67fe63341b8117d7e0d9acf0f1222d5138b9266) xfs_inode.c (c14329d39f2daa8132e1bbe5cc531da387bcf44a)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2000-2006 Silicon Graphics, Inc.
4 * All Rights Reserved.
5 */
6#include <linux/iversion.h>
7
8#include "xfs.h"

--- 774 unchanged lines hidden (view full) ---

783 xfs_ino_t ino,
784 umode_t mode,
785 xfs_nlink_t nlink,
786 dev_t rdev,
787 prid_t prid,
788 bool init_xattrs,
789 struct xfs_inode **ipp)
790{
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2000-2006 Silicon Graphics, Inc.
4 * All Rights Reserved.
5 */
6#include <linux/iversion.h>
7
8#include "xfs.h"

--- 774 unchanged lines hidden (view full) ---

783 xfs_ino_t ino,
784 umode_t mode,
785 xfs_nlink_t nlink,
786 dev_t rdev,
787 prid_t prid,
788 bool init_xattrs,
789 struct xfs_inode **ipp)
790{
791 struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
792 struct inode *dir = pip ? VFS_I(pip) : NULL;
793 struct xfs_mount *mp = tp->t_mountp;
794 struct xfs_inode *ip;
795 unsigned int flags;
796 int error;
797 struct timespec64 tv;
798 struct inode *inode;
799

--- 19 unchanged lines hidden (view full) ---

819
820 ASSERT(ip != NULL);
821 inode = VFS_I(ip);
822 set_nlink(inode, nlink);
823 inode->i_rdev = rdev;
824 ip->i_projid = prid;
825
826 if (dir && !(dir->i_mode & S_ISGID) && xfs_has_grpid(mp)) {
791 struct inode *dir = pip ? VFS_I(pip) : NULL;
792 struct xfs_mount *mp = tp->t_mountp;
793 struct xfs_inode *ip;
794 unsigned int flags;
795 int error;
796 struct timespec64 tv;
797 struct inode *inode;
798

--- 19 unchanged lines hidden (view full) ---

818
819 ASSERT(ip != NULL);
820 inode = VFS_I(ip);
821 set_nlink(inode, nlink);
822 inode->i_rdev = rdev;
823 ip->i_projid = prid;
824
825 if (dir && !(dir->i_mode & S_ISGID) && xfs_has_grpid(mp)) {
827 inode_fsuid_set(inode, mnt_userns);
826 inode_fsuid_set(inode, idmap);
828 inode->i_gid = dir->i_gid;
829 inode->i_mode = mode;
830 } else {
831 inode_init_owner(idmap, inode, dir, mode);
832 }
833
834 /*
835 * If the group ID of the new file does not match the effective group

--- 114 unchanged lines hidden (view full) ---

950 struct mnt_idmap *idmap,
951 xfs_inode_t *dp,
952 struct xfs_name *name,
953 umode_t mode,
954 dev_t rdev,
955 bool init_xattrs,
956 xfs_inode_t **ipp)
957{
827 inode->i_gid = dir->i_gid;
828 inode->i_mode = mode;
829 } else {
830 inode_init_owner(idmap, inode, dir, mode);
831 }
832
833 /*
834 * If the group ID of the new file does not match the effective group

--- 114 unchanged lines hidden (view full) ---

949 struct mnt_idmap *idmap,
950 xfs_inode_t *dp,
951 struct xfs_name *name,
952 umode_t mode,
953 dev_t rdev,
954 bool init_xattrs,
955 xfs_inode_t **ipp)
956{
958 struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
959 int is_dir = S_ISDIR(mode);
960 struct xfs_mount *mp = dp->i_mount;
961 struct xfs_inode *ip = NULL;
962 struct xfs_trans *tp = NULL;
963 int error;
964 bool unlock_dp_on_error = false;
965 prid_t prid;
966 struct xfs_dquot *udqp = NULL;

--- 8 unchanged lines hidden (view full) ---

975 if (xfs_is_shutdown(mp))
976 return -EIO;
977
978 prid = xfs_get_initial_prid(dp);
979
980 /*
981 * Make sure that we have allocated dquot(s) on disk.
982 */
957 int is_dir = S_ISDIR(mode);
958 struct xfs_mount *mp = dp->i_mount;
959 struct xfs_inode *ip = NULL;
960 struct xfs_trans *tp = NULL;
961 int error;
962 bool unlock_dp_on_error = false;
963 prid_t prid;
964 struct xfs_dquot *udqp = NULL;

--- 8 unchanged lines hidden (view full) ---

973 if (xfs_is_shutdown(mp))
974 return -EIO;
975
976 prid = xfs_get_initial_prid(dp);
977
978 /*
979 * Make sure that we have allocated dquot(s) on disk.
980 */
983 error = xfs_qm_vop_dqalloc(dp, mapped_fsuid(mnt_userns, &init_user_ns),
984 mapped_fsgid(mnt_userns, &init_user_ns), prid,
981 error = xfs_qm_vop_dqalloc(dp, mapped_fsuid(idmap, &init_user_ns),
982 mapped_fsgid(idmap, &init_user_ns), prid,
985 XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT,
986 &udqp, &gdqp, &pdqp);
987 if (error)
988 return error;
989
990 if (is_dir) {
991 resblks = XFS_MKDIR_SPACE_RES(mp, name->len);
992 tres = &M_RES(mp)->tr_mkdir;

--- 111 unchanged lines hidden (view full) ---

1104
1105int
1106xfs_create_tmpfile(
1107 struct mnt_idmap *idmap,
1108 struct xfs_inode *dp,
1109 umode_t mode,
1110 struct xfs_inode **ipp)
1111{
983 XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT,
984 &udqp, &gdqp, &pdqp);
985 if (error)
986 return error;
987
988 if (is_dir) {
989 resblks = XFS_MKDIR_SPACE_RES(mp, name->len);
990 tres = &M_RES(mp)->tr_mkdir;

--- 111 unchanged lines hidden (view full) ---

1102
1103int
1104xfs_create_tmpfile(
1105 struct mnt_idmap *idmap,
1106 struct xfs_inode *dp,
1107 umode_t mode,
1108 struct xfs_inode **ipp)
1109{
1112 struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
1113 struct xfs_mount *mp = dp->i_mount;
1114 struct xfs_inode *ip = NULL;
1115 struct xfs_trans *tp = NULL;
1116 int error;
1117 prid_t prid;
1118 struct xfs_dquot *udqp = NULL;
1119 struct xfs_dquot *gdqp = NULL;
1120 struct xfs_dquot *pdqp = NULL;

--- 4 unchanged lines hidden (view full) ---

1125 if (xfs_is_shutdown(mp))
1126 return -EIO;
1127
1128 prid = xfs_get_initial_prid(dp);
1129
1130 /*
1131 * Make sure that we have allocated dquot(s) on disk.
1132 */
1110 struct xfs_mount *mp = dp->i_mount;
1111 struct xfs_inode *ip = NULL;
1112 struct xfs_trans *tp = NULL;
1113 int error;
1114 prid_t prid;
1115 struct xfs_dquot *udqp = NULL;
1116 struct xfs_dquot *gdqp = NULL;
1117 struct xfs_dquot *pdqp = NULL;

--- 4 unchanged lines hidden (view full) ---

1122 if (xfs_is_shutdown(mp))
1123 return -EIO;
1124
1125 prid = xfs_get_initial_prid(dp);
1126
1127 /*
1128 * Make sure that we have allocated dquot(s) on disk.
1129 */
1133 error = xfs_qm_vop_dqalloc(dp, mapped_fsuid(mnt_userns, &init_user_ns),
1134 mapped_fsgid(mnt_userns, &init_user_ns), prid,
1130 error = xfs_qm_vop_dqalloc(dp, mapped_fsuid(idmap, &init_user_ns),
1131 mapped_fsgid(idmap, &init_user_ns), prid,
1135 XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT,
1136 &udqp, &gdqp, &pdqp);
1137 if (error)
1138 return error;
1139
1140 resblks = XFS_IALLOC_SPACE_RES(mp);
1141 tres = &M_RES(mp)->tr_create_tmpfile;
1142

--- 2401 unchanged lines hidden ---
1132 XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT,
1133 &udqp, &gdqp, &pdqp);
1134 if (error)
1135 return error;
1136
1137 resblks = XFS_IALLOC_SPACE_RES(mp);
1138 tres = &M_RES(mp)->tr_create_tmpfile;
1139

--- 2401 unchanged lines hidden ---