Commit b5a08423 authored by Darrick J. Wong's avatar Darrick J. Wong Committed by Darrick J. Wong

xfs: fix quota accounting when a mount is idmapped

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: f736d93d ("xfs: support idmapped mounts")
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarChristian Brauner <christian.brauner@ubuntu.com>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
parent a38fd874
...@@ -1007,7 +1007,8 @@ xfs_create( ...@@ -1007,7 +1007,8 @@ xfs_create(
/* /*
* Make sure that we have allocated dquot(s) on disk. * Make sure that we have allocated dquot(s) on disk.
*/ */
error = xfs_qm_vop_dqalloc(dp, current_fsuid(), current_fsgid(), prid, error = xfs_qm_vop_dqalloc(dp, fsuid_into_mnt(mnt_userns),
fsgid_into_mnt(mnt_userns), prid,
XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT,
&udqp, &gdqp, &pdqp); &udqp, &gdqp, &pdqp);
if (error) if (error)
...@@ -1157,7 +1158,8 @@ xfs_create_tmpfile( ...@@ -1157,7 +1158,8 @@ xfs_create_tmpfile(
/* /*
* Make sure that we have allocated dquot(s) on disk. * Make sure that we have allocated dquot(s) on disk.
*/ */
error = xfs_qm_vop_dqalloc(dp, current_fsuid(), current_fsgid(), prid, error = xfs_qm_vop_dqalloc(dp, fsuid_into_mnt(mnt_userns),
fsgid_into_mnt(mnt_userns), prid,
XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT,
&udqp, &gdqp, &pdqp); &udqp, &gdqp, &pdqp);
if (error) if (error)
......
...@@ -182,7 +182,8 @@ xfs_symlink( ...@@ -182,7 +182,8 @@ xfs_symlink(
/* /*
* Make sure that we have allocated dquot(s) on disk. * Make sure that we have allocated dquot(s) on disk.
*/ */
error = xfs_qm_vop_dqalloc(dp, current_fsuid(), current_fsgid(), prid, error = xfs_qm_vop_dqalloc(dp, fsuid_into_mnt(mnt_userns),
fsgid_into_mnt(mnt_userns), prid,
XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT,
&udqp, &gdqp, &pdqp); &udqp, &gdqp, &pdqp);
if (error) if (error)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment