[PATCH v2 4/4] mm/memfd_luo: use i_size_write() to set inode size during retrieve

From: Chenghao Duan

Date: Mon Mar 23 2026 - 07:16:58 EST


Use i_size_write() instead of directly assigning to inode->i_size
when restoring the memfd size in memfd_luo_retrieve(), to keep code
consistency.

No functional change intended.

Reviewed-by: Pasha Tatashin <pasha.tatashin@xxxxxxxxxx>
Signed-off-by: Chenghao Duan <duanchenghao@xxxxxxxxxx>
---
mm/memfd_luo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memfd_luo.c b/mm/memfd_luo.c
index bf827e574bec..76edf9a3f5b5 100644
--- a/mm/memfd_luo.c
+++ b/mm/memfd_luo.c
@@ -499,7 +499,7 @@ static int memfd_luo_retrieve(struct liveupdate_file_op_args *args)
}

vfs_setpos(file, ser->pos, MAX_LFS_FILESIZE);
- file->f_inode->i_size = ser->size;
+ i_size_write(file_inode(file), ser->size);

if (ser->nr_folios) {
folios_ser = kho_restore_vmalloc(&ser->folios);
--
2.25.1