From: Jaegeuk Kim Date: Wed, 27 Jan 2021 01:00:42 +0000 (-0800) Subject: f2fs: flush data when enabling checkpoint back X-Git-Tag: accepted/tizen/unified/20230118.172025~7865^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b0ff4fe746fd028eef920ddc8c7b0361c1ede6ec;p=platform%2Fkernel%2Flinux-rpi.git 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: stable@vger.kernel.org Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim --- diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index fc34324..429bc00 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);