xfs: limit extsize to size of AGs and/or MAXEXTLEN
commit5315837daee7ed76c31ef643915f7d76ef8c1aa3
authorDave Chinner <dchinner@redhat.com>
Thu, 27 Jan 2011 01:18:18 +0000 (27 12:18 +1100)
committerAlex Elder <aelder@sgi.com>
Fri, 28 Jan 2011 15:05:36 +0000 (28 09:05 -0600)
treede92499a896cc5d6702be364c9c3339641d3ed93
parent4ce159890c00e2cc705e955a939bf1dca7b07ab8
xfs: limit extsize to size of AGs and/or MAXEXTLEN

The extent size hint can be set to larger than an AG. This means
that the alignment process can push the range to be allocated
outside the bounds of the AG, resulting in assert failures or
corrupted bmbt records. Similarly, if the extsize is larger than the
maximum extent size supported, the alignment process will produce
extents that are too large to fit into the bmbt records, resulting
in a different type of assert/corruption failure.

Fix this by limiting extsize at the time іt is set firstly to be
less than MAXEXTLEN, then to be a maximum of half the size of the
AGs in the filesystem for non-realtime inodes. Realtime inodes do
not allocate out of AGs, so don't have to be restricted by the size
of AGs.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
fs/xfs/linux-2.6/xfs_ioctl.c