aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaegeuk Kim <[email protected]>2021-01-26 17:00:42 -0800
committerJaegeuk Kim <[email protected]>2021-02-01 14:32:50 -0800
commitb0ff4fe746fd028eef920ddc8c7b0361c1ede6ec (patch)
tree2df5a5dea02e0738f0a7b10d51a81f099f0fb258
parentd5f7bc0064e0541164bd3deeafad16bbb5992433 (diff)
f2fs: flush data when enabling checkpoint back
During checkpoint=disable period, f2fs bypasses all the synchronous IOs such as sync and fsync. So, when enabling it back, we must flush all of them in order to keep the data persistent. Otherwise, suddern power-cut right after enabling checkpoint will cause data loss. Fixes: 4354994f097d ("f2fs: checkpoint disabling") Cc: [email protected] Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
-rw-r--r--fs/f2fs/super.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index fc343243799c..429bc00af440 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1892,6 +1892,9 @@ restore_flag:
static void f2fs_enable_checkpoint(struct f2fs_sb_info *sbi)
{
+ /* we should flush all the data to keep data consistency */
+ sync_inodes_sb(sbi->sb);
+
down_write(&sbi->gc_lock);
f2fs_dirty_to_prefree(sbi);