The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v3 1/2] f2fs: fix to off-by-one issue in f2fs_zero_post_eof_page()
@ 2026-08-07 13:06 Chao Yu
  2026-08-07 13:06 ` [PATCH v3 2/2] f2fs: fix to zero post-EOF data when extending file size Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: Chao Yu @ 2026-08-07 13:06 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, Chao Yu, stable

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

Cc: stable@kernel.org
Fixes: ba8dac350faf ("f2fs: fix to zero post-eof page")
Signed-off-by: Chao Yu <chao@kernel.org>
---
 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 56529a82e027..9dbe509926b2 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-07 13:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-07 13:06 [PATCH v3 1/2] f2fs: fix to off-by-one issue in f2fs_zero_post_eof_page() Chao Yu
2026-08-07 13:06 ` [PATCH v3 2/2] f2fs: fix to zero post-EOF data when extending file size Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox