diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_ioctl.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c index ad442d9e392e..f5e2a19e0f8e 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl.c +++ b/fs/xfs/linux-2.6/xfs_ioctl.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include "xfs_dfrag.h" | 39 | #include "xfs_dfrag.h" |
40 | #include "xfs_fsops.h" | 40 | #include "xfs_fsops.h" |
41 | #include "xfs_vnodeops.h" | 41 | #include "xfs_vnodeops.h" |
42 | #include "xfs_discard.h" | ||
42 | #include "xfs_quota.h" | 43 | #include "xfs_quota.h" |
43 | #include "xfs_inode_item.h" | 44 | #include "xfs_inode_item.h" |
44 | #include "xfs_export.h" | 45 | #include "xfs_export.h" |
@@ -984,10 +985,22 @@ xfs_ioctl_setattr( | |||
984 | 985 | ||
985 | /* | 986 | /* |
986 | * Extent size must be a multiple of the appropriate block | 987 | * Extent size must be a multiple of the appropriate block |
987 | * size, if set at all. | 988 | * size, if set at all. It must also be smaller than the |
989 | * maximum extent size supported by the filesystem. | ||
990 | * | ||
991 | * Also, for non-realtime files, limit the extent size hint to | ||
992 | * half the size of the AGs in the filesystem so alignment | ||
993 | * doesn't result in extents larger than an AG. | ||
988 | */ | 994 | */ |
989 | if (fa->fsx_extsize != 0) { | 995 | if (fa->fsx_extsize != 0) { |
990 | xfs_extlen_t size; | 996 | xfs_extlen_t size; |
997 | xfs_fsblock_t extsize_fsb; | ||
998 | |||
999 | extsize_fsb = XFS_B_TO_FSB(mp, fa->fsx_extsize); | ||
1000 | if (extsize_fsb > MAXEXTLEN) { | ||
1001 | code = XFS_ERROR(EINVAL); | ||
1002 | goto error_return; | ||
1003 | } | ||
991 | 1004 | ||
992 | if (XFS_IS_REALTIME_INODE(ip) || | 1005 | if (XFS_IS_REALTIME_INODE(ip) || |
993 | ((mask & FSX_XFLAGS) && | 1006 | ((mask & FSX_XFLAGS) && |
@@ -996,6 +1009,10 @@ xfs_ioctl_setattr( | |||
996 | mp->m_sb.sb_blocklog; | 1009 | mp->m_sb.sb_blocklog; |
997 | } else { | 1010 | } else { |
998 | size = mp->m_sb.sb_blocksize; | 1011 | size = mp->m_sb.sb_blocksize; |
1012 | if (extsize_fsb > mp->m_sb.sb_agblocks / 2) { | ||
1013 | code = XFS_ERROR(EINVAL); | ||
1014 | goto error_return; | ||
1015 | } | ||
999 | } | 1016 | } |
1000 | 1017 | ||
1001 | if (fa->fsx_extsize % size) { | 1018 | if (fa->fsx_extsize % size) { |
@@ -1294,6 +1311,8 @@ xfs_file_ioctl( | |||
1294 | trace_xfs_file_ioctl(ip); | 1311 | trace_xfs_file_ioctl(ip); |
1295 | 1312 | ||
1296 | switch (cmd) { | 1313 | switch (cmd) { |
1314 | case FITRIM: | ||
1315 | return xfs_ioc_trim(mp, arg); | ||
1297 | case XFS_IOC_ALLOCSP: | 1316 | case XFS_IOC_ALLOCSP: |
1298 | case XFS_IOC_FREESP: | 1317 | case XFS_IOC_FREESP: |
1299 | case XFS_IOC_RESVSP: | 1318 | case XFS_IOC_RESVSP: |