aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2017-01-09 10:38:37 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-01-12 05:39:40 -0500
commit63fa793e757dfc08c09865d68936ce3d67a00047 (patch)
treeb672e75b7977ef25f4d2e3df50a5eda5536d5b8b /fs
parentf380ee72a7a498c934afe3aa67a50242b935f540 (diff)
xfs: check minimum block size for CRC filesystems
commit bec9d48d7a303a5bb95c05961ff07ec7eeb59058 upstream. Check the minimum block size on v5 filesystems. [dchinner: cleaned up XFS_MIN_CRC_BLOCKSIZE check] Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/libxfs/xfs_sb.c6
-rw-r--r--fs/xfs/libxfs/xfs_types.h3
2 files changed, 9 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
index 7a392402f2f8..2580262e4ea0 100644
--- a/fs/xfs/libxfs/xfs_sb.c
+++ b/fs/xfs/libxfs/xfs_sb.c
@@ -262,6 +262,12 @@ xfs_mount_validate_sb(
262 return -EFSCORRUPTED; 262 return -EFSCORRUPTED;
263 } 263 }
264 264
265 if (xfs_sb_version_hascrc(&mp->m_sb) &&
266 sbp->sb_blocksize < XFS_MIN_CRC_BLOCKSIZE) {
267 xfs_notice(mp, "v5 SB sanity check failed");
268 return -EFSCORRUPTED;
269 }
270
265 /* 271 /*
266 * Until this is fixed only page-sized or smaller data blocks work. 272 * Until this is fixed only page-sized or smaller data blocks work.
267 */ 273 */
diff --git a/fs/xfs/libxfs/xfs_types.h b/fs/xfs/libxfs/xfs_types.h
index 8d74870468c2..cf044c0f4d41 100644
--- a/fs/xfs/libxfs/xfs_types.h
+++ b/fs/xfs/libxfs/xfs_types.h
@@ -75,11 +75,14 @@ typedef __int64_t xfs_sfiloff_t; /* signed block number in a file */
75 * Minimum and maximum blocksize and sectorsize. 75 * Minimum and maximum blocksize and sectorsize.
76 * The blocksize upper limit is pretty much arbitrary. 76 * The blocksize upper limit is pretty much arbitrary.
77 * The sectorsize upper limit is due to sizeof(sb_sectsize). 77 * The sectorsize upper limit is due to sizeof(sb_sectsize).
78 * CRC enable filesystems use 512 byte inodes, meaning 512 byte block sizes
79 * cannot be used.
78 */ 80 */
79#define XFS_MIN_BLOCKSIZE_LOG 9 /* i.e. 512 bytes */ 81#define XFS_MIN_BLOCKSIZE_LOG 9 /* i.e. 512 bytes */
80#define XFS_MAX_BLOCKSIZE_LOG 16 /* i.e. 65536 bytes */ 82#define XFS_MAX_BLOCKSIZE_LOG 16 /* i.e. 65536 bytes */
81#define XFS_MIN_BLOCKSIZE (1 << XFS_MIN_BLOCKSIZE_LOG) 83#define XFS_MIN_BLOCKSIZE (1 << XFS_MIN_BLOCKSIZE_LOG)
82#define XFS_MAX_BLOCKSIZE (1 << XFS_MAX_BLOCKSIZE_LOG) 84#define XFS_MAX_BLOCKSIZE (1 << XFS_MAX_BLOCKSIZE_LOG)
85#define XFS_MIN_CRC_BLOCKSIZE (1 << (XFS_MIN_BLOCKSIZE_LOG + 1))
83#define XFS_MIN_SECTORSIZE_LOG 9 /* i.e. 512 bytes */ 86#define XFS_MIN_SECTORSIZE_LOG 9 /* i.e. 512 bytes */
84#define XFS_MAX_SECTORSIZE_LOG 15 /* i.e. 32768 bytes */ 87#define XFS_MAX_SECTORSIZE_LOG 15 /* i.e. 32768 bytes */
85#define XFS_MIN_SECTORSIZE (1 << XFS_MIN_SECTORSIZE_LOG) 88#define XFS_MIN_SECTORSIZE (1 << XFS_MIN_SECTORSIZE_LOG)