linux/fs/xfs/libxfs
Eric Sandeen 04dd1a0d4b 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>
2014-10-02 09:24:11 +10:00
..
xfs_ag.h
xfs_alloc_btree.c
xfs_alloc_btree.h
xfs_alloc.c xfs: add a few more verifier tests 2014-09-09 11:47:24 +10:00
xfs_alloc.h
xfs_attr_leaf.c
xfs_attr_leaf.h
xfs_attr_remote.c
xfs_attr_remote.h
xfs_attr_sf.h
xfs_attr.c
xfs_bit.h
xfs_bmap_btree.c xfs: require 64-bit sector_t 2014-07-30 09:12:05 +10:00
xfs_bmap_btree.h
xfs_bmap.c Merge branch 'xfs-misc-fixes-3.17-1' into for-next 2014-08-04 13:54:14 +10:00
xfs_bmap.h
xfs_btree.c Merge branch 'xfs-misc-fixes-3.17-1' into for-next 2014-08-04 13:54:14 +10:00
xfs_btree.h xfs: require 64-bit sector_t 2014-07-30 09:12:05 +10:00
xfs_cksum.h
xfs_da_btree.c xfs: don't send null bp to xfs_trans_brelse() 2014-10-02 09:23:49 +10:00
xfs_da_btree.h
xfs_da_format.c xfs: don't ASSERT on corrupt ftype 2014-09-23 16:05:32 +10:00
xfs_da_format.h
xfs_dinode.h
xfs_dir2_block.c
xfs_dir2_data.c
xfs_dir2_leaf.c
xfs_dir2_node.c
xfs_dir2_priv.h
xfs_dir2_sf.c xfs: require 64-bit sector_t 2014-07-30 09:12:05 +10:00
xfs_dir2.c xfs: combine xfs_dir_canenter into xfs_dir_createname 2014-09-09 11:58:07 +10:00
xfs_dir2.h xfs: check resblks before calling xfs_dir_canenter 2014-09-09 11:57:52 +10:00
xfs_dquot_buf.c
xfs_format.h xfs: require 64-bit sector_t 2014-07-30 09:12:05 +10:00
xfs_ialloc_btree.c
xfs_ialloc_btree.h
xfs_ialloc.c xfs: add a few more verifier tests 2014-09-09 11:47:24 +10:00
xfs_ialloc.h
xfs_inode_buf.c
xfs_inode_buf.h
xfs_inode_fork.c xfs: require 64-bit sector_t 2014-07-30 09:12:05 +10:00
xfs_inode_fork.h
xfs_inum.h xfs: require 64-bit sector_t 2014-07-30 09:12:05 +10:00
xfs_log_format.h xfs: require 64-bit sector_t 2014-07-30 09:12:05 +10:00
xfs_log_recover.h
xfs_log_rlimit.c
xfs_quota_defs.h
xfs_rtbitmap.c xfs: remove rbpp check from xfs_rtmodify_summary_int 2014-09-09 11:59:12 +10:00
xfs_sb.c xfs: fix crc field handling in xfs_sb_to/from_disk 2014-10-02 09:24:11 +10:00
xfs_sb.h xfs: require 64-bit sector_t 2014-07-30 09:12:05 +10:00
xfs_shared.h
xfs_symlink_remote.c
xfs_trans_resv.c
xfs_trans_resv.h
xfs_trans_space.h