* [f2fs-dev] [PATCH] f2fs: flush data when enabling checkpoint back
@ 2021-01-27 1:44 Jaegeuk Kim
2021-01-28 7:04 ` Chao Yu
0 siblings, 1 reply; 2+ messages in thread
From: Jaegeuk Kim @ 2021-01-27 1:44 UTC (permalink / raw)
To: linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Jaegeuk Kim, stable
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
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fs/f2fs/super.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 359cc5a2f8f5..073b51af62c8 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1887,6 +1887,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);
--
2.30.0.280.ga3ce27912f-goog
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: flush data when enabling checkpoint back
2021-01-27 1:44 [f2fs-dev] [PATCH] f2fs: flush data when enabling checkpoint back Jaegeuk Kim
@ 2021-01-28 7:04 ` Chao Yu
0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2021-01-28 7:04 UTC (permalink / raw)
To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel, kernel-team; +Cc: stable
On 2021/1/27 9:44, Jaegeuk Kim wrote:
> 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
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-28 7:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-27 1:44 [f2fs-dev] [PATCH] f2fs: flush data when enabling checkpoint back Jaegeuk Kim
2021-01-28 7:04 ` Chao Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).