[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260206-vfs-namespace-v70-f8476aa664c3@brauner>
Date: Fri, 6 Feb 2026 17:50:06 +0100
From: Christian Brauner <brauner@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Christian Brauner <brauner@...nel.org>,
linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [GIT PULL 10/12 for v7.0] vfs namespace
Hey Linus,
/* Summary */
This contains the mount changes for this cycle.
statmount: accept fd as a parameter
Extend struct mnt_id_req with a file descriptor field and a new
STATMOUNT_BY_FD flag. When set, statmount() returns mount information for the
mount the fd resides on — including detached mounts (unmounted via
umount2(MNT_DETACH)). For detached mounts the STATMOUNT_MNT_POINT and
STATMOUNT_MNT_NS_ID mask bits are cleared since neither is meaningful. The
capability check is skipped for STATMOUNT_BY_FD since holding an fd already
implies prior access to the mount and equivalent information is available
through fstatfs() and /proc/pid/mountinfo without privilege. Includes
comprehensive selftests covering both attached and detached mount cases.
fs: Remove internal old mount API code (1 patch)
Now that every in-tree filesystem has been converted to the new mount API,
remove all the legacy shim code in fs_context.c that handled unconverted
filesystems. This deletes ~280 lines including legacy_init_fs_context(), the
legacy_fs_context struct, and associated wrappers. The mount(2) syscall path
for userspace remains untouched. Documentation references to the legacy
callbacks are cleaned up.
mount: add OPEN_TREE_NAMESPACE (2 patches)
Add OPEN_TREE_NAMESPACE to open_tree(). Container runtimes currently use
CLONE_NEWNS to copy the caller's entire mount namespace — only to then
pivot_root() and recursively unmount everything they just copied. With large
mount tables and thousands of parallel container launches this creates
significant contention on the namespace semaphore.
OPEN_TREE_NAMESPACE copies only the specified mount tree (like
OPEN_TREE_CLONE) but returns a mount namespace fd instead of a detached mount
fd. The new namespace contains the copied tree mounted on top of a clone of
the real rootfs. This functions as a combined unshare(CLONE_NEWNS) +
pivot_root() in a single syscall. Works with user namespaces: an
unshare(CLONE_NEWUSER) followed by OPEN_TREE_NAMESPACE creates a mount
namespace owned by the new user namespace. Mount namespace file mounts are
excluded from the copy to prevent cycles. Includes ~1000 lines of selftests.
/* Testing */
gcc (Debian 14.2.0-19) 14.2.0
Debian clang version 19.1.7 (3+b1)
No build failures or warnings were observed.
/* Conflicts */
Merge conflicts with mainline
=============================
No known conflicts.
Merge conflicts with other trees
================================
The following changes since commit 8f0b4cce4481fb22653697cced8d0d04027cb1e8:
Linux 6.19-rc1 (2025-12-14 16:05:07 +1200)
are available in the Git repository at:
git@...olite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs tags/vfs-7.0-rc1.namespace
for you to fetch changes up to 1bce1a664ac25d37a327c433a01bc347f0a81bd6:
Merge patch series "mount: add OPEN_TREE_NAMESPACE" (2026-01-16 19:21:40 +0100)
----------------------------------------------------------------
vfs-7.0-rc1.namespace
Please consider pulling these changes from the signed vfs-7.0-rc1.namespace tag.
Thanks!
Christian
----------------------------------------------------------------
Bhavik Sachdev (3):
statmount: permission check should return EPERM
statmount: accept fd as a parameter
selftests: statmount: tests for STATMOUNT_BY_FD
Christian Brauner (4):
Merge patch series "statmount: accept fd as a parameter"
mount: add OPEN_TREE_NAMESPACE
selftests/open_tree: add OPEN_TREE_NAMESPACE tests
Merge patch series "mount: add OPEN_TREE_NAMESPACE"
Eric Sandeen (1):
fs: Remove internal old mount API code
Documentation/filesystems/locking.rst | 8 -
Documentation/filesystems/mount_api.rst | 2 -
Documentation/filesystems/porting.rst | 7 +-
Documentation/filesystems/vfs.rst | 58 +-
fs/fs_context.c | 208 +---
fs/fsopen.c | 10 -
fs/internal.h | 2 +-
fs/namespace.c | 265 ++++-
fs/nsfs.c | 13 +
include/linux/fs.h | 2 -
include/linux/fs/super_types.h | 1 -
include/uapi/linux/mount.h | 13 +-
.../selftests/filesystems/open_tree_ns/.gitignore | 1 +
.../selftests/filesystems/open_tree_ns/Makefile | 10 +
.../filesystems/open_tree_ns/open_tree_ns_test.c | 1030 ++++++++++++++++++++
.../selftests/filesystems/statmount/statmount.h | 15 +-
.../filesystems/statmount/statmount_test.c | 261 ++++-
.../filesystems/statmount/statmount_test_ns.c | 101 +-
tools/testing/selftests/filesystems/utils.c | 26 +
tools/testing/selftests/filesystems/utils.h | 1 +
20 files changed, 1669 insertions(+), 365 deletions(-)
create mode 100644 tools/testing/selftests/filesystems/open_tree_ns/.gitignore
create mode 100644 tools/testing/selftests/filesystems/open_tree_ns/Makefile
create mode 100644 tools/testing/selftests/filesystems/open_tree_ns/open_tree_ns_test.c
Powered by blists - more mailing lists