xfs: only validate summary counts on primary superblock
PATCH 1/1 xfs: only validate summary counts on primary superblock
From: Darrick J. Wong <[email protected]>
Skip the summary counter checks for secondary superblocks because userspace has always written the secondary supers with zeroed counters. mkfs.xfs fails immediately without this patch.
Signed-off-by Darrick J. Wong <[email protected]>
--- fs/xfs/libxfs/xfs_sb.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
fs/xfs/libxfs/xfs_sb.c +8 -4
@@ -148,6 +148,7 @@ xfs_validate_sb_read( STATIC intxfs_validate_sb_write (struct xfs_mount *mp, +struct xfs_buf *bp,struct xfs_sb *sbp) {/*
@@ -155,10 +156,13 @@ xfs_validate_sb_write(* the superblock. We skip this in the read validator because there * could be newer superblocks in the log and if the values are garbage * even after replay we'll recalculate them at the end of log mount. +* We only check the primary superblock to allow userspace tools to +* write secondary superblocks with zeroed counters. */ -if (sbp->sb_fdblocks > sbp->sb_dblocks || - !xfs_verify_icount (mp, sbp->sb_icount) || - sbp->sb_ifree > sbp->sb_icount) { +if (XFS_BUF_ADDR (bp) ==XFS_SB_DADDR && + (sbp->sb_fdblocks > sbp->sb_dblocks || + !xfs_verify_icount (mp, sbp->sb_icount) || + sbp->sb_ifree > sbp->sb_icount)) {xfs_warn (mp,"SB summary counter sanity check failed" );return -EFSCORRUPTED ; }
@@ -756,7 +760,7 @@ xfs_sb_write_verify( error =xfs_validate_sb_common (mp, bp, &sb);if (error) goto out_error; - error =xfs_validate_sb_write (mp, &sb); + error =xfs_validate_sb_write (mp, bp, &sb);if (error) goto out_error;
Quoted 7 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Skip the summary counter checks for secondary superblocks because userspace has always written the secondary supers with zeroed counters. mkfs.xfs fails immediately without this patch.
Signed-off-by Darrick J. Wong <[email protected]>
Bleh, self-NAK on this, never mind.
--D
Quoted 46 lines
--- fs/xfs/libxfs/xfs_sb.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)fs/xfs/libxfs/xfs_sb.c +8
-5@@ -148,6 +148,7 @@ xfs_validate_sb_read( STATIC intxfs_validate_sb_write (struct xfs_mount *mp, +struct xfs_buf *bp,struct xfs_sb *sbp) {/* @@ -155,10 +156,13 @@ xfs_validate_sb_write(* the superblock. We skip this in the read validator because there * could be newer superblocks in the log and if the values are garbage * even after replay we'll recalculate them at the end of log mount. +* We only check the primary superblock to allow userspace tools to +* write secondary superblocks with zeroed counters. */ -if (sbp->sb_fdblocks > sbp->sb_dblocks || - !xfs_verify_icount (mp, sbp->sb_icount) || - sbp->sb_ifree > sbp->sb_icount) { +if (XFS_BUF_ADDR (bp) ==XFS_SB_DADDR && + (sbp->sb_fdblocks > sbp->sb_dblocks || + !xfs_verify_icount (mp, sbp->sb_icount) || + sbp->sb_ifree > sbp->sb_icount)) {xfs_warn (mp,"SB summary counter sanity check failed" );return -EFSCORRUPTED ; }@@ -756,7 +760,7 @@ xfs_sb_write_verify( error =xfs_validate_sb_common (mp, bp, &sb);if (error) goto out_error; - error =xfs_validate_sb_write (mp, &sb); + error =xfs_validate_sb_write (mp, bp, &sb);if (error) goto out_error; --To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html