[PATCH v4 1/2] f2fs: fix to off-by-one issue in f2fs_zero_post_eof_page()

From: Chao Yu

Date: Sat Aug 08 2026 - 21:19:28 EST


Otherwise, it will drop one more page after new_size which is not
necessary.

Cc: stable@xxxxxxxxxx
Fixes: ba8dac350faf ("f2fs: fix to zero post-eof page")
Signed-off-by: Chao Yu <chao@xxxxxxxxxx>
---
v4:
- no changes
fs/f2fs/file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index b99d9cdf9ba7..be319a2e9830 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -50,7 +50,7 @@ static void f2fs_zero_post_eof_page(struct inode *inode,
if (lock)
filemap_invalidate_lock(inode->i_mapping);
/* zero or drop pages only in range of [old_size, new_size] */
- truncate_inode_pages_range(inode->i_mapping, old_size, new_size);
+ truncate_inode_pages_range(inode->i_mapping, old_size, new_size - 1);
if (lock)
filemap_invalidate_unlock(inode->i_mapping);
}
--
2.49.0