From: Christian Brauner <brauner@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Christian Brauner <brauner@kernel.org>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [GIT PULL] vfs mount
Date: Sat, 18 Jan 2025 14:06:58 +0100 [thread overview]
Message-ID: <20250118-vfs-mount-bc855e2c7463@brauner> (raw)
Hey Linus,
/* Summary */
This contains mount update for this cycle:
- Add a mountinfo program to demonstrate statmount()/listmount()
Add a new "mountinfo" sample userland program that demonstrates how to
use statmount() and listmount() to get at the same info that
/proc/pid/mountinfo provides.
- Remove pointless nospec.h include.
- Prepend statmount.mnt_opts string with security_sb_mnt_opts()
Currently these mount options aren't accessible via statmount().
- Add new mount namespaces to mount namespace rbtree outside of the
namespace semaphore.
- Lockless mount namespace lookup
Currently we take the read lock when looking for a mount namespace to
list mounts in. We can make this lockless. The simple search case can
just use a sequence counter to detect concurrent changes to the
rbtree.
For walking the list of mount namespaces sequentially via nsfs we keep
a separate rcu list as rb_prev() and rb_next() aren't usable safely
with rcu. Currently there is no primitive for retrieving the previous
list member. To do this we need a new deletion primitive that doesn't
poison the prev pointer and a corresponding retrieval helper.
Since creating mount namespaces is a relatively rare event compared
with querying mounts in a foreign mount namespace this is worth it.
Once libmount and systemd pick up this mechanism to list mounts in
foreign mount namespaces this will be used very frequently.
- Add extended selftests for lockless mount namespace iteration.
- Add a sample program to list all mounts on the system, i.e., in all
mount namespaces.
- Improve mount namespace iteration performance
Make finding the last or first mount to start iterating the mount
namespace from an O(1) operation and add selftests for iterating the
mount table starting from the first and last mount.
- Use an xarray for the old mount id
While the ida does use the xarray internally we can use it explicitly
which allows us to increment the unique mount id under the xa lock.
This allows us to remove the atomic as we're now allocating both ids
in one go.
/* Testing */
gcc version 14.2.0 (Debian 14.2.0-6)
Debian clang version 16.0.6 (27+b1)
No build failures or warnings were observed.
/* Conflicts */
Merge conflicts with mainline
=============================
No known conflicts.
Merge conflicts with other trees
================================
This will have a merge conflict with vfs-6.14.mount pull request sent in
https://lore.kernel.org/r/20250118-vfs-pidfs-5921bfa5632a@brauner
and it can be resolved as follows:
diff --cc fs/namespace.c
index 64deda6f5b2c,371c860f49de..000000000000
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@@ -32,8 -32,6 +32,7 @@@
#include <linux/fs_context.h>
#include <linux/shmem_fs.h>
#include <linux/mnt_idmapping.h>
+#include <linux/pidfs.h>
- #include <linux/nospec.h>
#include "pnode.h"
#include "internal.h"
The following changes since commit 344bac8f0d73fe970cd9f5b2f132906317d29e8b:
fs: kill MNT_ONRB (2025-01-09 16:58:50 +0100)
are available in the Git repository at:
git@gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs tags/vfs-6.14-rc1.mount
for you to fetch changes up to f79e6eb84d4d2bff99e3ca6c1f140b2af827e904:
samples/vfs/mountinfo: Use __u64 instead of uint64_t (2025-01-10 12:08:27 +0100)
Please consider pulling these changes from the signed vfs-6.14-rc1.mount tag.
Thanks!
Christian
----------------------------------------------------------------
vfs-6.14-rc1.mount
----------------------------------------------------------------
Christian Brauner (17):
mount: remove inlude/nospec.h include
fs: add mount namespace to rbtree late
Merge patch series "fs: listmount()/statmount() fix and sample program"
fs: lockless mntns rbtree lookup
rculist: add list_bidir_{del,prev}_rcu()
fs: lockless mntns lookup for nsfs
fs: simplify rwlock to spinlock
seltests: move nsfs into filesystems subfolder
selftests: add tests for mntns iteration
selftests: remove unneeded include
samples: add test-list-all-mounts
Merge patch series "fs: lockless mntns lookup"
fs: cache first and last mount
selftests: add listmount() iteration tests
Merge patch series "fs: tweak mntns iteration"
fs: use xarray for old mount id
fs: remove useless lockdep assertion
Geert Uytterhoeven (1):
samples/vfs/mountinfo: Use __u64 instead of uint64_t
Jeff Layton (2):
samples: add a mountinfo program to demonstrate statmount()/listmount()
fs: prepend statmount.mnt_opts string with security_sb_mnt_opts()
fs/mount.h | 31 ++-
fs/namespace.c | 200 +++++++++------
fs/nsfs.c | 5 +-
include/linux/rculist.h | 44 ++++
samples/vfs/.gitignore | 2 +
samples/vfs/Makefile | 2 +-
samples/vfs/mountinfo.c | 273 +++++++++++++++++++++
samples/vfs/test-list-all-mounts.c | 235 ++++++++++++++++++
.../selftests/{ => filesystems}/nsfs/.gitignore | 1 +
.../selftests/{ => filesystems}/nsfs/Makefile | 4 +-
.../selftests/{ => filesystems}/nsfs/config | 0
.../selftests/filesystems/nsfs/iterate_mntns.c | 149 +++++++++++
.../selftests/{ => filesystems}/nsfs/owner.c | 0
.../selftests/{ => filesystems}/nsfs/pidns.c | 0
.../selftests/filesystems/statmount/Makefile | 2 +-
.../filesystems/statmount/listmount_test.c | 66 +++++
tools/testing/selftests/pidfd/pidfd.h | 1 -
17 files changed, 918 insertions(+), 97 deletions(-)
create mode 100644 samples/vfs/mountinfo.c
create mode 100644 samples/vfs/test-list-all-mounts.c
rename tools/testing/selftests/{ => filesystems}/nsfs/.gitignore (78%)
rename tools/testing/selftests/{ => filesystems}/nsfs/Makefile (50%)
rename tools/testing/selftests/{ => filesystems}/nsfs/config (100%)
create mode 100644 tools/testing/selftests/filesystems/nsfs/iterate_mntns.c
rename tools/testing/selftests/{ => filesystems}/nsfs/owner.c (100%)
rename tools/testing/selftests/{ => filesystems}/nsfs/pidns.c (100%)
create mode 100644 tools/testing/selftests/filesystems/statmount/listmount_test.c
next reply other threads:[~2025-01-18 13:07 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-18 13:06 Christian Brauner [this message]
2025-01-20 0:10 ` [GIT PULL] vfs mount Sasha Levin
2025-01-20 12:21 ` Christian Brauner
2025-01-20 12:26 ` [GIT PULL] vfs mount v2 Christian Brauner
2025-01-20 19:00 ` pr-tracker-bot
2025-01-20 18:59 ` [GIT PULL] vfs mount pr-tracker-bot
-- strict thread matches above, loose matches on Subject: below --
2025-03-22 10:13 Christian Brauner
2025-03-24 21:00 ` pr-tracker-bot
2025-04-01 17:07 ` Leon Romanovsky
2025-04-03 8:29 ` Christian Brauner
2025-04-03 15:15 ` Christian Brauner
2025-04-03 15:34 ` James Bottomley
2025-04-03 17:21 ` Mateusz Guzik
2025-04-03 18:09 ` Linus Torvalds
2025-04-03 19:17 ` Mateusz Guzik
2025-04-04 8:28 ` Christoph Hellwig
2025-04-04 14:19 ` Linus Torvalds
2025-04-07 8:51 ` Christoph Hellwig
2025-04-07 16:00 ` Linus Torvalds
2025-04-08 5:06 ` Christoph Hellwig
2025-04-07 11:22 ` Christian Brauner
2025-04-03 18:24 ` Leon Romanovsky
2025-04-03 19:18 ` Linus Torvalds
2025-04-03 19:45 ` Christian Brauner
2025-04-03 19:55 ` Christian Brauner
2025-04-04 6:16 ` Leon Romanovsky
2025-04-03 19:38 ` James Bottomley
2024-09-13 14:41 Christian Brauner
2024-09-14 2:33 ` Stephen Rothwell
2024-09-16 11:09 ` pr-tracker-bot
2024-05-10 11:46 Christian Brauner
2024-05-13 19:38 ` pr-tracker-bot
2023-06-23 11:03 [GIT PULL] vfs: mount Christian Brauner
2023-06-26 17:34 ` pr-tracker-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250118-vfs-mount-bc855e2c7463@brauner \
--to=brauner@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).