diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2021-08-20 00:00:57 +0300 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2021-08-30 20:12:47 +0300 |
commit | dddd3d65293a52c2c3850c19b1e5115712e534d8 (patch) | |
tree | dfbcce98983e1e41ed25cee8365056fe6112df5a /fs/f2fs/file.c | |
parent | c8dc3047c48540183744f959412d44b08c5435e1 (diff) | |
download | linux-dddd3d65293a52c2c3850c19b1e5115712e534d8.tar.xz |
f2fs: guarantee to write dirty data when enabling checkpoint back
We must flush all the dirty data when enabling checkpoint back. Let's guarantee
that first by adding a retry logic on sync_inodes_sb(). In addition to that,
this patch adds to flush data in fsync when checkpoint is disabled, which can
mitigate the sync_inodes_sb() failures in advance.
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r-- | fs/f2fs/file.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 7fca3ac75e9f..f30b841d4e5a 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -263,8 +263,7 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end, }; unsigned int seq_id = 0; - if (unlikely(f2fs_readonly(inode->i_sb) || - is_sbi_flag_set(sbi, SBI_CP_DISABLED))) + if (unlikely(f2fs_readonly(inode->i_sb))) return 0; trace_f2fs_sync_file_enter(inode); @@ -278,7 +277,7 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end, ret = file_write_and_wait_range(file, start, end); clear_inode_flag(inode, FI_NEED_IPU); - if (ret) { + if (ret || is_sbi_flag_set(sbi, SBI_CP_DISABLED)) { trace_f2fs_sync_file_exit(inode, cp_reason, datasync, ret); return ret; } |