| From: |
| Christian Brauner <brauner-AT-kernel.org> |
| To: |
| linux-fsdevel-AT-vger.kernel.org |
| Subject: |
| [PATCH 0/7] fsmount: add FSMOUNT_NAMESPACE |
| Date: |
| Thu, 22 Jan 2026 11:48:45 +0100 |
| Message-ID: |
| <20260122-work-fsmount-namespace-v1-0-5ef0a886e646@kernel.org> |
| Cc: |
| Alexander Viro <viro-AT-zeniv.linux.org.uk>, Jan Kara <jack-AT-suse.cz>, Jeff Layton <jlayton-AT-kernel.org>, Amir Goldstein <amir73il-AT-gmail.com>, Josef Bacik <josef-AT-toxicpanda.com>, Aleksa Sarai <cyphar-AT-cyphar.com>, Christian Brauner <brauner-AT-kernel.org> |
| Archive-link: |
| Article |
Add FSMOUNT_NAMESPACE flag to fsmount() that creates a new mount
namespace with the newly created filesystem attached to a copy of the
real rootfs. This returns a namespace file descriptor instead of an
O_PATH mount fd, similar to how OPEN_TREE_NAMESPACE works for
open_tree().
This allows creating a new filesystem and immediately placing it in a
new mount namespace in a single operation, which is useful for container
runtimes and other namespace-based isolation mechanisms.
This accompanies OPEN_TREE_NAMESPACE and avoids a needless detour via
OPEN_TREE_NAMESPACE to get the same effect. Will be especially useful
when you mount an actual filesystem to be used as the container rootfs.
Signed-off-by: Christian Brauner <brauner@kernel.org>
---
Christian Brauner (7):
mount: start iterating from start of rbtree
mount: simplify __do_loopback()
mount: add FSMOUNT_NAMESPACE
tools: update mount.h header
selftests/statmount: add statmount_alloc() helper
selftests: add FSMOUNT_NAMESPACE tests
selftests/open_tree_ns: fix compilation
fs/namespace.c | 84 +-
include/uapi/linux/mount.h | 1 +
tools/include/uapi/linux/mount.h | 14 +-
.../selftests/filesystems/fsmount_ns/.gitignore | 1 +
.../selftests/filesystems/fsmount_ns/Makefile | 10 +
.../filesystems/fsmount_ns/fsmount_ns_test.c | 1138 ++++++++++++++++++++
.../selftests/filesystems/open_tree_ns/Makefile | 2 +-
.../filesystems/open_tree_ns/open_tree_ns_test.c | 33 +-
.../selftests/filesystems/statmount/statmount.h | 27 +
9 files changed, 1242 insertions(+), 68 deletions(-)
---
base-commit: 1bce1a664ac25d37a327c433a01bc347f0a81bd6
change-id: 20260121-work-fsmount-namespace-4242e3df359e