diff options
author | Chao Yu <chao@kernel.org> | 2024-08-07 18:24:35 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2024-08-21 00:56:28 +0000 |
commit | ebd3309aec6271c4616573b0cb83ea25e623070a (patch) | |
tree | 863cfa16f2863c4a83acc48458bcf4133ab5f43a /fs/f2fs | |
parent | a4d7f2b3238fd5f76b9e6434a0bd5d2e29049cff (diff) |
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@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/file.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 73f70a7a2567..5fb8e4242c7a 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -2195,6 +2195,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]); |