diff mbox series

[f2fs-dev,v4,3/4] f2fs: atomic: fix to truncate pagecache before on-disk metadata truncation

Message ID 20240807102435.2198055-1-chao@kernel.org (mailing list archive)
State Accepted
Commit ebd3309aec6271c4616573b0cb83ea25e623070a
Headers show
Series None | expand

Commit Message

Chao Yu Aug. 7, 2024, 10:24 a.m. UTC
We should always truncate pagecache while truncating on-disk data.

Fixes: a46bebd502fe ("f2fs: synchronize atomic write aborts")
Signed-off-by: Chao Yu <chao@kernel.org>
---
v4:
- don't reset i_size to zero.
 fs/f2fs/file.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

bugzilla-daemon--- via Linux-f2fs-devel Aug. 30, 2024, 8:51 p.m. UTC | #1
Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:

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")
> Signed-off-by: Chao Yu <chao@kernel.org>
> ---
> 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!
diff mbox series

Patch

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]);