mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
f2fs: fix to update superblock crc in sanity_check_area_boundary()
This patch fixes the bug reported by Sashiko:
We should update superblock crc along w/ raw_super->segment_count in
sanity_check_area_boundary() if sb_checksum feature is enabled.
Cc: stable@kernel.org
Fixes: d440c52d31 ("f2fs: support superblock checksum")
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
cd6d8b1891
commit
f8f956c7ec
|
|
@ -4084,6 +4084,12 @@ static inline bool sanity_check_area_boundary(struct f2fs_sb_info *sbi,
|
|||
/* fix in-memory information all the time */
|
||||
raw_super->segment_count = cpu_to_le32((main_end_blkaddr -
|
||||
segment0_blkaddr) >> log_blocks_per_seg);
|
||||
if (__F2FS_HAS_FEATURE(raw_super, F2FS_FEATURE_SB_CHKSUM)) {
|
||||
__u32 crc = f2fs_crc32(raw_super,
|
||||
offsetof(struct f2fs_super_block, crc));
|
||||
|
||||
raw_super->crc = cpu_to_le32(crc);
|
||||
}
|
||||
|
||||
if (f2fs_readonly(sb) || f2fs_hw_is_readonly(sbi)) {
|
||||
set_sbi_flag(sbi, SBI_NEED_SB_WRITE);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user