提交 765d3c39 编写于 作者: D Darrick J. Wong

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: NDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: NEric Sandeen <sandeen@redhat.com>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
上级 78bba5c8
...@@ -1211,6 +1211,13 @@ xfs_swap_extents_check_format( ...@@ -1211,6 +1211,13 @@ xfs_swap_extents_check_format(
struct xfs_inode *tip) /* tmp inode */ 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 */ /* Should never get a local format */
if (ip->i_d.di_format == XFS_DINODE_FMT_LOCAL || if (ip->i_d.di_format == XFS_DINODE_FMT_LOCAL ||
tip->i_d.di_format == XFS_DINODE_FMT_LOCAL) tip->i_d.di_format == XFS_DINODE_FMT_LOCAL)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册