Skip to content

Commit 4d8ec91

Browse files
author
Jaegeuk Kim
committed
f2fs: should not truncate blocks during roll-forward recovery
If the file preallocated blocks and fsync'ed, we should not truncate them during roll-forward recovery which will recover i_size correctly back. Fixes: d4dd19e ("f2fs: do not expose unwritten blocks to user by DIO") Cc: <stable@vger.kernel.org> # 5.17+ Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 27275f1 commit 4d8ec91

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

fs/f2fs/inode.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,8 @@ struct inode *f2fs_iget(struct super_block *sb, unsigned long ino)
550550
}
551551
f2fs_set_inode_flags(inode);
552552

553-
if (file_should_truncate(inode)) {
553+
if (file_should_truncate(inode) &&
554+
!is_sbi_flag_set(sbi, SBI_POR_DOING)) {
554555
ret = f2fs_truncate(inode);
555556
if (ret)
556557
goto bad_inode;

0 commit comments

Comments
 (0)