From: Pasha Tatashin Date: Thu, 26 Mar 2026 16:39:42 +0000 (+0000) Subject: memfd: implement get_id for memfd_luo X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bc3a5763f4664c5da812eb3f14d55b0c99abd4ab;p=thirdparty%2Fkernel%2Flinux.git memfd: implement get_id for memfd_luo Memfds are identified by their underlying inode. Implement get_id for memfd_luo to return the inode pointer. This prevents the same memfd from being managed twice by LUO if the same inode is pointed by multiple file objects. Link: https://lore.kernel.org/20260326163943.574070-3-pasha.tatashin@soleen.com Signed-off-by: Pasha Tatashin Reviewed-by: Pratyush Yadav (Google) Cc: David Matlack Cc: Mike Rapoport (Microsoft) Cc: Samiullah Khawaja Cc: Shuah Khan Cc: Christian Brauner Signed-off-by: Andrew Morton --- diff --git a/mm/memfd_luo.c b/mm/memfd_luo.c index bc7f4f045edf..9130e6ce396d 100644 --- a/mm/memfd_luo.c +++ b/mm/memfd_luo.c @@ -560,6 +560,11 @@ static bool memfd_luo_can_preserve(struct liveupdate_file_handler *handler, return shmem_file(file) && !inode->i_nlink; } +static unsigned long memfd_luo_get_id(struct file *file) +{ + return (unsigned long)file_inode(file); +} + static const struct liveupdate_file_ops memfd_luo_file_ops = { .freeze = memfd_luo_freeze, .finish = memfd_luo_finish, @@ -567,6 +572,7 @@ static const struct liveupdate_file_ops memfd_luo_file_ops = { .preserve = memfd_luo_preserve, .unpreserve = memfd_luo_unpreserve, .can_preserve = memfd_luo_can_preserve, + .get_id = memfd_luo_get_id, .owner = THIS_MODULE, };