diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_ioctl.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c index b06ede1d0bed..0ca0e3c024d7 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl.c +++ b/fs/xfs/linux-2.6/xfs_ioctl.c | |||
@@ -695,14 +695,19 @@ xfs_ioc_fsgeometry_v1( | |||
695 | xfs_mount_t *mp, | 695 | xfs_mount_t *mp, |
696 | void __user *arg) | 696 | void __user *arg) |
697 | { | 697 | { |
698 | xfs_fsop_geom_v1_t fsgeo; | 698 | xfs_fsop_geom_t fsgeo; |
699 | int error; | 699 | int error; |
700 | 700 | ||
701 | error = xfs_fs_geometry(mp, (xfs_fsop_geom_t *)&fsgeo, 3); | 701 | error = xfs_fs_geometry(mp, &fsgeo, 3); |
702 | if (error) | 702 | if (error) |
703 | return -error; | 703 | return -error; |
704 | 704 | ||
705 | if (copy_to_user(arg, &fsgeo, sizeof(fsgeo))) | 705 | /* |
706 | * Caller should have passed an argument of type | ||
707 | * xfs_fsop_geom_v1_t. This is a proper subset of the | ||
708 | * xfs_fsop_geom_t that xfs_fs_geometry() fills in. | ||
709 | */ | ||
710 | if (copy_to_user(arg, &fsgeo, sizeof(xfs_fsop_geom_v1_t))) | ||
706 | return -XFS_ERROR(EFAULT); | 711 | return -XFS_ERROR(EFAULT); |
707 | return 0; | 712 | return 0; |
708 | } | 713 | } |
@@ -985,10 +990,22 @@ xfs_ioctl_setattr( | |||
985 | 990 | ||
986 | /* | 991 | /* |
987 | * Extent size must be a multiple of the appropriate block | 992 | * Extent size must be a multiple of the appropriate block |
988 | * size, if set at all. | 993 | * size, if set at all. It must also be smaller than the |
994 | * maximum extent size supported by the filesystem. | ||
995 | * | ||
996 | * Also, for non-realtime files, limit the extent size hint to | ||
997 | * half the size of the AGs in the filesystem so alignment | ||
998 | * doesn't result in extents larger than an AG. | ||
989 | */ | 999 | */ |
990 | if (fa->fsx_extsize != 0) { | 1000 | if (fa->fsx_extsize != 0) { |
991 | xfs_extlen_t size; | 1001 | xfs_extlen_t size; |
1002 | xfs_fsblock_t extsize_fsb; | ||
1003 | |||
1004 | extsize_fsb = XFS_B_TO_FSB(mp, fa->fsx_extsize); | ||
1005 | if (extsize_fsb > MAXEXTLEN) { | ||
1006 | code = XFS_ERROR(EINVAL); | ||
1007 | goto error_return; | ||
1008 | } | ||
992 | 1009 | ||
993 | if (XFS_IS_REALTIME_INODE(ip) || | 1010 | if (XFS_IS_REALTIME_INODE(ip) || |
994 | ((mask & FSX_XFLAGS) && | 1011 | ((mask & FSX_XFLAGS) && |
@@ -997,6 +1014,10 @@ xfs_ioctl_setattr( | |||
997 | mp->m_sb.sb_blocklog; | 1014 | mp->m_sb.sb_blocklog; |
998 | } else { | 1015 | } else { |
999 | size = mp->m_sb.sb_blocksize; | 1016 | size = mp->m_sb.sb_blocksize; |
1017 | if (extsize_fsb > mp->m_sb.sb_agblocks / 2) { | ||
1018 | code = XFS_ERROR(EINVAL); | ||
1019 | goto error_return; | ||
1020 | } | ||
1000 | } | 1021 | } |
1001 | 1022 | ||
1002 | if (fa->fsx_extsize % size) { | 1023 | if (fa->fsx_extsize % size) { |