summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap_util.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2020-05-13 01:42:51 +0200
committerDarrick J. Wong <darrick.wong@oracle.com>2020-05-19 18:40:56 +0200
commit765d3c393c222c3bb281885ea211c8ebc08250b4 (patch)
tree44bebfad379400a07d796ab5acaed2e9bedd9aa4 /fs/xfs/xfs_bmap_util.c
parentxfs: use ordered buffers to initialize dquot buffers during quotacheck (diff)
downloadlinux-765d3c393c222c3bb281885ea211c8ebc08250b4.tar.xz
linux-765d3c393c222c3bb281885ea211c8ebc08250b4.zip
xfs: don't allow SWAPEXT if we'd screw up quota accounting
Since the old SWAPEXT ioctl doesn't know how to adjust quota ids, bail out of the ids don't match and quotas are enabled. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/xfs_bmap_util.c')
-rw-r--r--fs/xfs/xfs_bmap_util.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index cc23a3e23e2d..b8acfd4d3ca6 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -1211,6 +1211,13 @@ xfs_swap_extents_check_format(
struct xfs_inode *tip) /* tmp inode */
{
+ /* User/group/project quota ids must match if quotas are enforced. */
+ if (XFS_IS_QUOTA_ON(ip->i_mount) &&
+ (!uid_eq(VFS_I(ip)->i_uid, VFS_I(tip)->i_uid) ||
+ !gid_eq(VFS_I(ip)->i_gid, VFS_I(tip)->i_gid) ||
+ ip->i_d.di_projid != tip->i_d.di_projid))
+ return -EINVAL;
+
/* Should never get a local format */
if (ip->i_d.di_format == XFS_DINODE_FMT_LOCAL ||
tip->i_d.di_format == XFS_DINODE_FMT_LOCAL)