Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7a01e707 authored by Eric Sandeen's avatar Eric Sandeen Committed by Dave Chinner
Browse files

xfs: xfs_sb_read_verify() doesn't flag bad crcs on primary sb



My earlier commit 10e6e65d deserves a layer or two of brown paper
bags.  The logic in that commit means that a CRC failure on the
primary superblock will *never* result in an error return.

Hopefully this fixes it, so that we always return the error
if it's a primary superblock, otherwise only if the filesystem
has CRCs enabled.

Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
Signed-off-by: default avatarBen Myers <bpm@sgi.com>
parent 3895e51f
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -614,7 +614,7 @@ xfs_sb_read_verify(
		if (!xfs_verify_cksum(bp->b_addr, be16_to_cpu(dsb->sb_sectsize),
		if (!xfs_verify_cksum(bp->b_addr, be16_to_cpu(dsb->sb_sectsize),
				      offsetof(struct xfs_sb, sb_crc))) {
				      offsetof(struct xfs_sb, sb_crc))) {
			/* Only fail bad secondaries on a known V5 filesystem */
			/* Only fail bad secondaries on a known V5 filesystem */
			if (bp->b_bn != XFS_SB_DADDR &&
			if (bp->b_bn == XFS_SB_DADDR ||
			    xfs_sb_version_hascrc(&mp->m_sb)) {
			    xfs_sb_version_hascrc(&mp->m_sb)) {
				error = EFSCORRUPTED;
				error = EFSCORRUPTED;
				goto out_error;
				goto out_error;