LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] f2fs: don't ignore writing pages on fsync during checkpoint=disable
@ 2021-08-23 17:01 Jaegeuk Kim
  2021-08-24  1:08 ` [f2fs-dev] " Chao Yu
  2021-08-25 21:33 ` [PATCH v2] " Jaegeuk Kim
  0 siblings, 2 replies; 9+ messages in thread
From: Jaegeuk Kim @ 2021-08-23 17:01 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel; +Cc: Jaegeuk Kim

We must flush dirty pages when calling fsync() during checkpoint=disable.
Returning zero makes inode being clear, which fails to flush them when
enabling checkpoint back even by sync_inodes_sb().

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/file.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index d4fc5e0d2ffe..45c54332358b 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -262,8 +262,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);
@@ -277,7 +276,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;
 	}
-- 
2.33.0.rc2.250.ged5fa647cd-goog


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-08-27 14:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-23 17:01 [PATCH] f2fs: don't ignore writing pages on fsync during checkpoint=disable Jaegeuk Kim
2021-08-24  1:08 ` [f2fs-dev] " Chao Yu
2021-08-24 17:09   ` Jaegeuk Kim
2021-08-24 23:30     ` Chao Yu
2021-08-25 21:31       ` Jaegeuk Kim
2021-08-25 21:33 ` [PATCH v2] " Jaegeuk Kim
2021-08-26  0:16   ` [f2fs-dev] " Chao Yu
2021-08-26 16:52   ` [f2fs-dev] [PATCH v3] " Jaegeuk Kim
2021-08-27 14:36     ` 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).