Skip to contentSkip to conversation

f2fs: should not truncate blocks during roll-forward recovery

PATCH New Jaegeuk Kim 1 participant 1 message Apr 22, 2022

Subsystems (2)
lore
Share & tools
lore

Jaegeuk Kim

author maintainer
#0 lore raw

PATCH 1/1 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 d4dd19ec1ea0 ("f2fs: do not expose unwritten blocks to user by DIO")
Cc <[email protected]> # 5.17+
---
 fs/f2fs/inode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/f2fs/inode.c +2 -1
index 71f232dcf3c2..83639238a1fe 100644
@@ -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;
Signature · 1 line
2.36.0.rc2.479.g8af0fa9b8e-goog