[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240726012204.1306174-1-chao@kernel.org>
Date: Fri, 26 Jul 2024 09:22:04 +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 v2 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>
---
v2:
- fix to use cow_inode instead of inode
fs/f2fs/file.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 6c62f76474d1..54886ddcb8ab 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -2202,6 +2202,7 @@ 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 */
+ truncate_setsize(fi->cow_inode, 0);
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