[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240807102435.2198055-1-chao@kernel.org>
Date: Wed, 7 Aug 2024 18:24:35 +0800
From: Chao Yu <chao@...nel.org>
To: jaegeuk@...nel.org
Cc: linux-f2fs-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org,
Chao Yu <chao@...nel.org>
Subject: [PATCH v4 3/4] f2fs: atomic: fix to truncate pagecache before on-disk metadata truncation
We should always truncate pagecache while truncating on-disk data.
Fixes: a46bebd502fe ("f2fs: synchronize atomic write aborts")
Signed-off-by: Chao Yu <chao@...nel.org>
---
v4:
- don't reset i_size to zero.
fs/f2fs/file.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index ac61c88f7688..eaa39c50f782 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -2199,6 +2199,10 @@ static int f2fs_ioc_start_atomic_write(struct file *filp, bool truncate)
F2FS_I(fi->cow_inode)->atomic_inode = inode;
} else {
/* Reuse the already created COW inode */
+ f2fs_bug_on(sbi, get_dirty_pages(fi->cow_inode));
+
+ invalidate_mapping_pages(fi->cow_inode->i_mapping, 0, -1);
+
ret = f2fs_do_truncate_blocks(fi->cow_inode, 0, true);
if (ret) {
f2fs_up_write(&fi->i_gc_rwsem[WRITE]);
--
2.40.1
Powered by blists - more mailing lists