mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
f2fs: atomic: fix to truncate pagecache before on-disk metadata truncation
[ Upstream commit ebd3309aec6271c4616573b0cb83ea25e623070a ]
We should always truncate pagecache while truncating on-disk data.
Fixes: a46bebd502 ("f2fs: synchronize atomic write aborts")
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
25c5d480d2
commit
b094fedb26
@@ -2171,6 +2171,10 @@ static int f2fs_ioc_start_atomic_write(struct file *filp)
|
|||||||
clear_inode_flag(fi->cow_inode, FI_INLINE_DATA);
|
clear_inode_flag(fi->cow_inode, FI_INLINE_DATA);
|
||||||
} else {
|
} else {
|
||||||
/* Reuse the already created COW inode */
|
/* 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);
|
ret = f2fs_do_truncate_blocks(fi->cow_inode, 0, true);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
f2fs_up_write(&fi->i_gc_rwsem[WRITE]);
|
f2fs_up_write(&fi->i_gc_rwsem[WRITE]);
|
||||||
|
|||||||
Reference in New Issue
Block a user