Skip to contentSkip to conversation

f2fs: atomic: fix to truncate pagecache before on-disk metadata truncation

PATCH New Chao Yu 2 participants 2 messages Aug 7, 2024 – Aug 30, 2024 F2FS file system

lore
Share & tools
lore

Chao Yu

author maintainer
#0 lore raw

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")

---
v4:
- don't reset i_size to zero.

 fs/f2fs/file.c | 4 ++++
 1 file changed, 4 insertions(+)
fs/f2fs/file.c +4 -0
index ac61c88f7688..eaa39c50f782 100644
@@ -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]);
Signature · 1 line
2.40.1
#1 lore raw
This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <[email protected]>:

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:

Quoted 9 lines · On Wed, 7 Aug 2024 18:24:35 +0800 you wrote:

We should always truncate pagecache while truncating on-disk data.

Fixes a46bebd502fe ("f2fs: synchronize atomic write aborts")

---
v4:
- don't reset i_size to zero.

 fs/f2fs/file.c | 4 ++++
 1 file changed, 4 insertions(+)

Here is the summary with links:
- [f2fs-dev,v4,3/4] f2fs: atomic: fix to truncate pagecache before on-disk metadata truncation

    https://git.kernel.org/jaegeuk/f2fs/c/ebd3309aec62

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html