Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

f2fs: Add a new CP flag to help fsck fix resize SPO issues

Add and set a new CP flag CP_RESIZEFS_FLAG during
online resize FS to help fsck fix the metadata mismatch
that may happen due to SPO during resize, where SB
got updated but CP data couldn't be written yet.

fsck errors -
Info: CKPT version = 6ed7bccb
Wrong user_block_count(2233856)
[f2fs_do_mount:3365] Checkpoint is polluted

Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

authored by

Sahitya Tummala and committed by
Jaegeuk Kim
c84ef3c5 68275682

+7 -2
+6 -2
fs/f2fs/checkpoint.c
··· 1298 1298 else 1299 1299 __clear_ckpt_flags(ckpt, CP_ORPHAN_PRESENT_FLAG); 1300 1300 1301 - if (is_sbi_flag_set(sbi, SBI_NEED_FSCK) || 1302 - is_sbi_flag_set(sbi, SBI_IS_RESIZEFS)) 1301 + if (is_sbi_flag_set(sbi, SBI_NEED_FSCK)) 1303 1302 __set_ckpt_flags(ckpt, CP_FSCK_FLAG); 1303 + 1304 + if (is_sbi_flag_set(sbi, SBI_IS_RESIZEFS)) 1305 + __set_ckpt_flags(ckpt, CP_RESIZEFS_FLAG); 1306 + else 1307 + __clear_ckpt_flags(ckpt, CP_RESIZEFS_FLAG); 1304 1308 1305 1309 if (is_sbi_flag_set(sbi, SBI_CP_DISABLED)) 1306 1310 __set_ckpt_flags(ckpt, CP_DISABLED_FLAG);
+1
include/linux/f2fs_fs.h
··· 125 125 /* 126 126 * For checkpoint 127 127 */ 128 + #define CP_RESIZEFS_FLAG 0x00004000 128 129 #define CP_DISABLED_QUICK_FLAG 0x00002000 129 130 #define CP_DISABLED_FLAG 0x00001000 130 131 #define CP_QUOTA_NEED_FSCK_FLAG 0x00000800