aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs/discard.h
diff options
context:
space:
mode:
authorSu Yue2021-02-11 16:38:28 +0800
committerDavid Sterba2021-02-12 14:48:24 +0100
commit83c68bbcb6ac2dbbcaf12e2281a29a9f73b97d0f (patch)
tree1f096452c2e5b57c033eeeb41018983b8dfd3a1e /fs/btrfs/discard.h
parent9ad6d91f056b99dbe59a262810cb342519ea8d39 (diff)
btrfs: initialize fs_info::csum_size earlier in open_ctree
User reported that btrfs-progs misc-tests/028-superblock-recover fails: [TEST/misc] 028-superblock-recover unexpected success: mounted fs with corrupted superblock test failed for case 028-superblock-recover The test case expects that a broken image with bad superblock will be rejected to be mounted. However, the test image just passed csum check of superblock and was successfully mounted. Commit 55fc29bed8dd ("btrfs: use cached value of fs_info::csum_size everywhere") replaces all calls to btrfs_super_csum_size by fs_info::csum_size. The calls include the place where fs_info->csum_size is not initialized. So btrfs_check_super_csum() passes because memcmp() with len 0 always returns 0. Fix it by caching csum size in btrfs_fs_info::csum_size once we know the csum type in superblock is valid in open_ctree(). Link: https://github.com/kdave/btrfs-progs/issues/250 Fixes: 55fc29bed8dd ("btrfs: use cached value of fs_info::csum_size everywhere") Signed-off-by: Su Yue <l@damenly.su> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/discard.h')
0 files changed, 0 insertions, 0 deletions