On Wed, Mar 03, 2021 at 10:33:52AM -0800, Darrick J. Wong wrote: > On Wed, Mar 03, 2021 at 02:44:01PM +0000, Christian Brauner wrote: > > On Tue, Mar 02, 2021 at 02:28:22PM -0800, Darrick J. Wong wrote: > > > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > > > > > Nowadays, we indirectly use the idmap-aware helper functions in the VFS > > > to set the initial uid and gid of a file being created. Unfortunately, > > > we didn't convert the quota code, which means we attach the wrong dquots > > > to files created on an idmapped mount. > > > > > > Fixes: f736d93d76d3 ("xfs: support idmapped mounts") > > > Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> > > > --- > > > > This looks good but it misses one change, I think. The > > xfs_ioctl_setattr() needs to take the mapping into account as well: > > > > diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c > > index 99dfe89a8d08..067366bf9a59 100644 > > --- a/fs/xfs/xfs_ioctl.c > > +++ b/fs/xfs/xfs_ioctl.c > > @@ -1460,8 +1460,8 @@ xfs_ioctl_setattr( > > * because the i_*dquot fields will get updated anyway. > > */ > > if (XFS_IS_QUOTA_ON(mp)) { > > - error = xfs_qm_vop_dqalloc(ip, VFS_I(ip)->i_uid, > > - VFS_I(ip)->i_gid, fa->fsx_projid, > > + error = xfs_qm_vop_dqalloc(ip, i_uid_into_mnt(mnt_userns, VFS_I(ip)), > > + i_gid_into_mnt(mnt_userns, VFS_I(ip)), fa->fsx_projid, > > XFS_QMOPT_PQUOTA, NULL, NULL, &pdqp); > > The uid/gid parameters here don't matter because the "XFS_QMOPT_PQUOTA" > flag by itself here means that _dqalloc only looks at the project id > argument. Ah, thanks! (Maybe a comment would be good or just idmaped them anyway.) Thanks! Christian