Skip to content

Commit

Permalink
f2fs: should not truncate blocks during roll-forward recovery
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Jaegeuk Kim committed Apr 22, 2022
1 parent 27275f1 commit 4d8ec91
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/f2fs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,8 @@ struct inode *f2fs_iget(struct super_block *sb, unsigned long ino)
}
f2fs_set_inode_flags(inode);

if (file_should_truncate(inode)) {
if (file_should_truncate(inode) &&
!is_sbi_flag_set(sbi, SBI_POR_DOING)) {
ret = f2fs_truncate(inode);
if (ret)
goto bad_inode;
Expand Down

0 comments on commit 4d8ec91

Please sign in to comment.