fsck.f2fs: update kernel version in superblock on forced check

commit 91f9db23f6
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

In 1126e38 (fsck.f2fs: add --{no-}kernel-check to bypass kernel version diff or
not) the automatic check on a kernel version change was made optional and
disabled by default on non-Android systems. This also disabled the update of
the kernel version stored in the superblock if --kernel-check is not given.
Restore the update in case a full check is forced via -y or -f to properly
reflect the version in the superblock.

Signed-off-by: Michael Lass <bevan@bi-co.net>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
This commit is contained in:
Michael Lass 2021-05-01 15:52:41 +02:00 committed by dongsenhao
parent 8d2dfb7edd
commit be44193e03

View File

@ -967,12 +967,13 @@ int validate_super_block(struct f2fs_sb_info *sbi, enum SB_ADDR sb_addr)
c.sb_version, c.version);
if (!c.no_kernel_check &&
memcmp(c.sb_version, c.version, VERSION_LEN)) {
c.auto_fix = 0;
c.fix_on = 1;
}
if (c.fix_on) {
memcpy(sbi->raw_super->version,
c.version, VERSION_LEN);
update_superblock(sbi->raw_super, SB_MASK(sb_addr));
c.auto_fix = 0;
c.fix_on = 1;
}
print_sb_state(sbi->raw_super);
return 0;