fsck.f2fs: do not roll forward a checkpoint-disabled image
PATCH 1/1 fsck.f2fs: do not roll forward a checkpoint-disabled image
From: Daeho Jeong <[email protected]>
With checkpoint=disable, the kernel does not write a checkpoint at umount. The last checkpoint is the one written when checkpoint was disabled, with CP_DISABLED_FLAG set and without CP_UMOUNT_FLAG. The kernel never rolls forward such an image: f2fs_fill_super() skips the recovery when CP_DISABLED_FLAG is set, and drops all writes after the checkpoint.
fsck decides to record fsync data only by CP_UMOUNT_FLAG, so it walks the warm node chain of an image that the kernel will not recover. While checkpoint is disabled, SSR reuses blocks written and invalidated after the checkpoint, so the chain can point back to a block written earlier in the same session with the same cp_ver. fsck then reports "detect looped node chain" and fails. xfstests generic/320 and generic/642 hit this almost every time with checkpoint=disable.
Skip recording fsync data when CP_DISABLED_FLAG is set, as the kernel does.
--- fsck/mount.c | 4 ++++ 1 file changed, 4 insertions(+)
fsck/mount.c +4 -0
@@ -4096,6 +4096,10 @@ static int record_fsync_data(struct f2fs_sb_info *sbi)if (!need_fsync_data_record (sbi))return 0 ; +/* the kernel does not roll forward a checkpoint-disabled image */ +if (is_set_ckpt_flags (F2FS_CKPT (sbi),CP_DISABLED_FLAG )) +return 0 ; + ret =f2fs_find_fsync_inode (sbi, &inode_list);if (ret) goto out;
Signature · 1 line
2.56.0.385.gd3acb90ef8-goog