Commit ebd3309a authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim

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

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

Fixes: a46bebd5 ("f2fs: synchronize atomic write aborts")
Signed-off-by: default avatarChao Yu <chao@kernel.org>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent a4d7f2b3
......@@ -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]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment