]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit - repair/sb.c
repair: fix v5 sb ino alignment calculation for large blocksizes
authorBrian Foster <bfoster@redhat.com>
Thu, 5 Feb 2015 23:31:44 +0000 (10:31 +1100)
committerDave Chinner <david@fromorbit.com>
Thu, 5 Feb 2015 23:31:44 +0000 (10:31 +1100)
commit16e16276896509e05330f7bff988bdfb1130c89b
tree9b01015a09ac4d15cf9bb9d787ab1644ef1f3851
parent89c4bb8eb3de54aaeb523b8862c9cf6de73d1984
repair: fix v5 sb ino alignment calculation for large blocksizes

xfs_repair validates the superblock inode alignment field against
several possible valid values. On v5 superblocks, the inode alignment
can be scaled up based on the inode size in relation to the minimum
inode size.

If the block size is larger than the default cluster size (consider
large page size arches such as ppc64), the initial alignment value
calculates to zero. If the inode size is large enough such that
sb_inoalignmt is not zero, sb_validate_ino_align() scales the align
value by the factor of inode size increase. If align is zero, however,
we multiply by zero, the subsequent check incorrectly fails and the
overall superblock verification fails as well. To reproduce, format an
fs as follows on ppc64 and run xfs_repair:

mkfs.xfs -f -m crc=1 -b size=64k -i size=2k <dev>

Fix the scaled alignment calculation by scaling the default cluster size
appropriately to avoid a multiplication by zero.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
repair/sb.c