diff options
Diffstat (limited to 'fs/xfs/xfs_mount.c')
-rw-r--r-- | fs/xfs/xfs_mount.c | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 77ffe3ce71fe..2be5e5cf897a 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -348,7 +348,7 @@ xfs_mount_validate_sb( | |||
348 | } | 348 | } |
349 | 349 | ||
350 | /* | 350 | /* |
351 | * More sanity checking. These were stolen directly from | 351 | * More sanity checking. Most of these were stolen directly from |
352 | * xfs_repair. | 352 | * xfs_repair. |
353 | */ | 353 | */ |
354 | if (unlikely( | 354 | if (unlikely( |
@@ -371,23 +371,13 @@ xfs_mount_validate_sb( | |||
371 | (sbp->sb_blocklog - sbp->sb_inodelog != sbp->sb_inopblog) || | 371 | (sbp->sb_blocklog - sbp->sb_inodelog != sbp->sb_inopblog) || |
372 | (sbp->sb_rextsize * sbp->sb_blocksize > XFS_MAX_RTEXTSIZE) || | 372 | (sbp->sb_rextsize * sbp->sb_blocksize > XFS_MAX_RTEXTSIZE) || |
373 | (sbp->sb_rextsize * sbp->sb_blocksize < XFS_MIN_RTEXTSIZE) || | 373 | (sbp->sb_rextsize * sbp->sb_blocksize < XFS_MIN_RTEXTSIZE) || |
374 | (sbp->sb_imax_pct > 100 /* zero sb_imax_pct is valid */))) { | 374 | (sbp->sb_imax_pct > 100 /* zero sb_imax_pct is valid */) || |
375 | sbp->sb_dblocks == 0 || | ||
376 | sbp->sb_dblocks > XFS_MAX_DBLOCKS(sbp) || | ||
377 | sbp->sb_dblocks < XFS_MIN_DBLOCKS(sbp))) { | ||
375 | if (loud) | 378 | if (loud) |
376 | xfs_warn(mp, "SB sanity check 1 failed"); | 379 | XFS_CORRUPTION_ERROR("SB sanity check failed", |
377 | return XFS_ERROR(EFSCORRUPTED); | 380 | XFS_ERRLEVEL_LOW, mp, sbp); |
378 | } | ||
379 | |||
380 | /* | ||
381 | * Sanity check AG count, size fields against data size field | ||
382 | */ | ||
383 | if (unlikely( | ||
384 | sbp->sb_dblocks == 0 || | ||
385 | sbp->sb_dblocks > | ||
386 | (xfs_drfsbno_t)sbp->sb_agcount * sbp->sb_agblocks || | ||
387 | sbp->sb_dblocks < (xfs_drfsbno_t)(sbp->sb_agcount - 1) * | ||
388 | sbp->sb_agblocks + XFS_MIN_AG_BLOCKS)) { | ||
389 | if (loud) | ||
390 | xfs_warn(mp, "SB sanity check 2 failed"); | ||
391 | return XFS_ERROR(EFSCORRUPTED); | 381 | return XFS_ERROR(EFSCORRUPTED); |
392 | } | 382 | } |
393 | 383 | ||
@@ -864,7 +854,8 @@ xfs_update_alignment(xfs_mount_t *mp) | |||
864 | if ((BBTOB(mp->m_dalign) & mp->m_blockmask) || | 854 | if ((BBTOB(mp->m_dalign) & mp->m_blockmask) || |
865 | (BBTOB(mp->m_swidth) & mp->m_blockmask)) { | 855 | (BBTOB(mp->m_swidth) & mp->m_blockmask)) { |
866 | if (mp->m_flags & XFS_MOUNT_RETERR) { | 856 | if (mp->m_flags & XFS_MOUNT_RETERR) { |
867 | xfs_warn(mp, "alignment check 1 failed"); | 857 | xfs_warn(mp, "alignment check failed: " |
858 | "(sunit/swidth vs. blocksize)"); | ||
868 | return XFS_ERROR(EINVAL); | 859 | return XFS_ERROR(EINVAL); |
869 | } | 860 | } |
870 | mp->m_dalign = mp->m_swidth = 0; | 861 | mp->m_dalign = mp->m_swidth = 0; |
@@ -875,6 +866,8 @@ xfs_update_alignment(xfs_mount_t *mp) | |||
875 | mp->m_dalign = XFS_BB_TO_FSBT(mp, mp->m_dalign); | 866 | mp->m_dalign = XFS_BB_TO_FSBT(mp, mp->m_dalign); |
876 | if (mp->m_dalign && (sbp->sb_agblocks % mp->m_dalign)) { | 867 | if (mp->m_dalign && (sbp->sb_agblocks % mp->m_dalign)) { |
877 | if (mp->m_flags & XFS_MOUNT_RETERR) { | 868 | if (mp->m_flags & XFS_MOUNT_RETERR) { |
869 | xfs_warn(mp, "alignment check failed: " | ||
870 | "(sunit/swidth vs. ag size)"); | ||
878 | return XFS_ERROR(EINVAL); | 871 | return XFS_ERROR(EINVAL); |
879 | } | 872 | } |
880 | xfs_warn(mp, | 873 | xfs_warn(mp, |
@@ -889,8 +882,8 @@ xfs_update_alignment(xfs_mount_t *mp) | |||
889 | mp->m_swidth = XFS_BB_TO_FSBT(mp, mp->m_swidth); | 882 | mp->m_swidth = XFS_BB_TO_FSBT(mp, mp->m_swidth); |
890 | } else { | 883 | } else { |
891 | if (mp->m_flags & XFS_MOUNT_RETERR) { | 884 | if (mp->m_flags & XFS_MOUNT_RETERR) { |
892 | xfs_warn(mp, | 885 | xfs_warn(mp, "alignment check failed: " |
893 | "stripe alignment turned off: sunit(%d) less than bsize(%d)", | 886 | "sunit(%d) less than bsize(%d)", |
894 | mp->m_dalign, | 887 | mp->m_dalign, |
895 | mp->m_blockmask +1); | 888 | mp->m_blockmask +1); |
896 | return XFS_ERROR(EINVAL); | 889 | return XFS_ERROR(EINVAL); |