aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/libxfs/xfs_sb.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
index ca1b3a7a9171..081f46e30556 100644
--- a/fs/xfs/libxfs/xfs_sb.c
+++ b/fs/xfs/libxfs/xfs_sb.c
@@ -148,6 +148,7 @@ xfs_validate_sb_read(
148STATIC int 148STATIC int
149xfs_validate_sb_write( 149xfs_validate_sb_write(
150 struct xfs_mount *mp, 150 struct xfs_mount *mp,
151 struct xfs_buf *bp,
151 struct xfs_sb *sbp) 152 struct xfs_sb *sbp)
152{ 153{
153 /* 154 /*
@@ -155,10 +156,15 @@ xfs_validate_sb_write(
155 * the superblock. We skip this in the read validator because there 156 * the superblock. We skip this in the read validator because there
156 * could be newer superblocks in the log and if the values are garbage 157 * could be newer superblocks in the log and if the values are garbage
157 * even after replay we'll recalculate them at the end of log mount. 158 * even after replay we'll recalculate them at the end of log mount.
159 *
160 * mkfs has traditionally written zeroed counters to inprogress and
161 * secondary superblocks, so allow this usage to continue because
162 * we never read counters from such superblocks.
158 */ 163 */
159 if (sbp->sb_fdblocks > sbp->sb_dblocks || 164 if (XFS_BUF_ADDR(bp) == XFS_SB_DADDR && !sbp->sb_inprogress &&
160 !xfs_verify_icount(mp, sbp->sb_icount) || 165 (sbp->sb_fdblocks > sbp->sb_dblocks ||
161 sbp->sb_ifree > sbp->sb_icount) { 166 !xfs_verify_icount(mp, sbp->sb_icount) ||
167 sbp->sb_ifree > sbp->sb_icount)) {
162 xfs_warn(mp, "SB summary counter sanity check failed"); 168 xfs_warn(mp, "SB summary counter sanity check failed");
163 return -EFSCORRUPTED; 169 return -EFSCORRUPTED;
164 } 170 }
@@ -756,7 +762,7 @@ xfs_sb_write_verify(
756 error = xfs_validate_sb_common(mp, bp, &sb); 762 error = xfs_validate_sb_common(mp, bp, &sb);
757 if (error) 763 if (error)
758 goto out_error; 764 goto out_error;
759 error = xfs_validate_sb_write(mp, &sb); 765 error = xfs_validate_sb_write(mp, bp, &sb);
760 if (error) 766 if (error)
761 goto out_error; 767 goto out_error;
762 768