linux/arch/um
Mickaël Salaün 74ce793bcb
hostfs: Fix ephemeral inodes
hostfs creates a new inode for each opened or created file, which
created useless inode allocations and forbade identifying a host file
with a kernel inode.

Fix this uncommon filesystem behavior by tying kernel inodes to host
file's inode and device IDs.  Even if the host filesystem inodes may be
recycled, this cannot happen while a file referencing it is opened,
which is the case with hostfs.  It should be noted that hostfs inode IDs
may not be unique for the same hostfs superblock because multiple host's
(backed) superblocks may be used.

Delete inodes when dropping them to force backed host's file descriptors
closing.

This enables to entirely remove ARCH_EPHEMERAL_INODES, and then makes
Landlock fully supported by UML.  This is very useful for testing
changes.

These changes also factor out and simplify some helpers thanks to the
new hostfs_inode_update() and the hostfs_iget() revamp: read_name(),
hostfs_create(), hostfs_lookup(), hostfs_mknod(), and
hostfs_fill_sb_common().

A following commit with new Landlock tests check this new hostfs inode
consistency.

Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Richard Weinberger <richard@nod.at>
Link: https://lore.kernel.org/r/20230612191430.339153-2-mic@digikod.net
Signed-off-by: Mickaël Salaün <mic@digikod.net>
2023-06-12 21:26:19 +02:00
..
configs treewide: defconfig: address renamed CONFIG_DEBUG_INFO=y 2022-09-11 21:55:05 -07:00
drivers um: harddog: fix modular build 2023-05-10 00:21:30 +02:00
include um: make stub data pages size tweakable 2023-04-20 23:08:43 +02:00
kernel um: make stub data pages size tweakable 2023-04-20 23:08:43 +02:00
os-Linux This pull request contains the following changes for UML: 2023-05-03 19:02:03 -07:00
scripts um: prevent user code in modules 2023-04-20 23:06:38 +02:00
.gitignore um: gitignore: Add kernel/capflags.c 2021-12-21 21:22:43 +01:00
Kbuild kbuild: require all architectures to have arch/$(SRCARCH)/Kbuild 2021-05-26 23:10:37 +09:00
Kconfig hostfs: Fix ephemeral inodes 2023-06-12 21:26:19 +02:00
Kconfig.debug um: Disable CONFIG_GCOV with MODULES 2021-04-15 23:10:33 +02:00
Makefile um: Support LTO 2023-02-13 10:14:31 +01:00
Makefile-os-Linux
Makefile-skas