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: <[email protected]> # 5.17+ Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 27275f1 commit 4d8ec91

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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)