diff options
author | Eric Sandeen <sandeen@sandeen.net> | 2014-10-01 19:24:11 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-10-01 19:24:11 -0400 |
commit | 04dd1a0d4b17a71220eae4fb313218f15a49bcdd (patch) | |
tree | b1947cec8a738c5d711b3c6416399080ec145443 /fs/xfs/xfs_iomap.c | |
parent | 6ee49a20c13b4b4e79a3bba406df8106cff284a1 (diff) |
xfs: fix crc field handling in xfs_sb_to/from_disk
I discovered this in userspace, but the same change applies
to the kernel.
If we xfs_mdrestore an image from a non-crc filesystem, lo
and behold the restored image has gained a CRC:
# db/xfs_metadump.sh -o /dev/sdc1 - | xfs_mdrestore - test.img
# xfs_db -c "sb 0" -c "p crc" /dev/sdc1
crc = 0 (correct)
# xfs_db -c "sb 0" -c "p crc" test.img
crc = 0xb6f8d6a0 (correct)
This is because xfs_sb_from_disk doesn't fill in sb_crc,
but xfs_sb_to_disk(XFS_SB_ALL_BITS) does write the in-memory
CRC to disk - so we get uninitialized memory on disk.
Fix this by always initializing sb_crc to 0 when we read
the superblock, and masking out the CRC bit from ALL_BITS
when we write it.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_iomap.c')
0 files changed, 0 insertions, 0 deletions