Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 046c59c1 authored by Jaegeuk Kim's avatar Jaegeuk Kim Committed by Jaegeuk Kim
Browse files

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: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent ff6bdecf
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1876,6 +1876,9 @@ static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi)

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);