mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
f2fs: fix to check return value of f2fs_do_truncate_blocks()
[ Upstream commitb851ee6ba3] Otherwise, if truncation on cow_inode failed, remained data may pollute current transaction of atomic write. Cc: Daeho Jeong <daehojeong@google.com> 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
a8091dc814
commit
2eb5d0165b
@@ -2115,7 +2115,11 @@ 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_do_truncate_blocks(fi->cow_inode, 0, true);
|
ret = f2fs_do_truncate_blocks(fi->cow_inode, 0, true);
|
||||||
|
if (ret) {
|
||||||
|
f2fs_up_write(&fi->i_gc_rwsem[WRITE]);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
f2fs_write_inode(inode, NULL);
|
f2fs_write_inode(inode, NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user