The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH RFC v3 00/12] namespace-aware configfs
@ 2026-06-23  9:15 Hannes Reinecke
  2026-06-23  9:15 ` [PATCH RFC v3 01/12] fs/configfs: rework configfs_is_root() Hannes Reinecke
                   ` (12 more replies)
  0 siblings, 13 replies; 15+ messages in thread
From: Hannes Reinecke @ 2026-06-23  9:15 UTC (permalink / raw)
  To: Andreas Hindborg, Breno Leitao, Alexander Viro, Christian Brauner,
	Jan Kara, Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni
  Cc: linux-kernel, linux-fsdevel, linux-nvme, Hannes Reinecke

Hey all,

during discussions at LSF/MM I thought it would be quite helpful
to make configfs namespace aware, such that one could do:

unshare --mnt
mount -t configfs none /sys/kernel/config

and get a new instance of configfs. This will allow to have distinct
configurations for each namespace.
This is particularly helpful if you want to run eg nvmet in a container;
with this patchset each container can have its own configuration, and
one can simulate a multi-node nvmet cluster using containers.

How it works:
The configfs 'root' entries are stored in 'configfs_super_info', which
can be looked up from an xarray using the (network) namespace ID as the index.
A configfs subsystem can be converted to be namespace aware by implementing
the new subsyste callbacks 'fill_subsystem()' and 'clear_subsystem', which
are responsible for populating the subsystem structure.
Upon registration via 'register_subsystem()' the subsystem is put in a
linked list within 'configfs_super_info'. So when mount() is called from
a different namespace this list is traversed, and new subsystems are created
in the new namespace using the callbacks.

Open Issues:
- I've added a new function 'mnt_clone_direct()' to clone the vfsmount
  entry (the original code just did a simple_pin_fs()). Not sure if
  that's correct. Christian?
- Ideally I would love to make the whole thing work without having
  to mount a new configfs instance from within the container.
  Again, not sure if that's possible.
- I've decided to base it off the net namespace (and not any namespace).
  That makes implementation easier, but requires the various subsystems
  to actually _use_ the network namespace.
  The current use-case (nvmet) does that, so it works for me :-)

Otherwise, as usual, commands and reviews are welcome.

Changes to the original submission:
- Changed to use 'net' namespace instead of 'mnt' namespace
- Smaller fixes as suggested by sashiko.

Signed-off-by: Hannes Reinecke <hare@kernel.org>
---
Changes in v3:
- Split off nvmet patches
- kbuild robot fixes
- Simplify namespace selection
- Link to v2: https://lore.kernel.org/r/20260619-configfs-ns-v2-0-82fd7094b8dc@kernel.org

---
Hannes Reinecke (12):
      fs/configfs: rework configfs_is_root()
      fs/configfs: dynamically allocate super_info
      fs/configfs: separate out configfs_{link,unlink}_root()
      fs/configfs: add superblock as attribute to configfs_pin_fs()
      fs/configfs: add 'fill_subsystem' and 'clear_subsystem' callbacks
      fs/namespace: implement mnt_clone_direct()
      fs/configfs: switch to get_tree_keyed()
      fs/configfs: open-code simple_pin_fs()
      nvmet: make discovery subsystem dynamic
      nvmet: per net-namespace port list
      nvmet: make configfs setup namespace aware
      nvmet: enable transports for net namespaces

 drivers/nvme/target/configfs.c  | 206 +++++++++++++++++++++++++++------
 drivers/nvme/target/core.c      |  36 +++---
 drivers/nvme/target/discovery.c |  91 +++++++++++----
 drivers/nvme/target/loop.c      |   4 +
 drivers/nvme/target/nvmet.h     |  15 ++-
 drivers/nvme/target/rdma.c      |   6 +-
 drivers/nvme/target/tcp.c       |   6 +-
 fs/configfs/configfs_internal.h |  23 +++-
 fs/configfs/dir.c               | 188 +++++++++++++++++++++++++-----
 fs/configfs/mount.c             | 248 +++++++++++++++++++++++++++++++++-------
 fs/namespace.c                  |  11 ++
 include/linux/configfs.h        |   8 ++
 include/linux/mount.h           |   1 +
 13 files changed, 682 insertions(+), 161 deletions(-)
---
base-commit: 66affa37cfac0aec061cc4bcf4a065b0c52f7e19
change-id: 20260619-configfs-ns-b5748b366366

Best regards,
-- 
Hannes Reinecke <hare@kernel.org>


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2026-06-23 14:37 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-23  9:15 [PATCH RFC v3 00/12] namespace-aware configfs Hannes Reinecke
2026-06-23  9:15 ` [PATCH RFC v3 01/12] fs/configfs: rework configfs_is_root() Hannes Reinecke
2026-06-23 12:50   ` Breno Leitao
2026-06-23  9:15 ` [PATCH RFC v3 02/12] fs/configfs: dynamically allocate super_info Hannes Reinecke
2026-06-23  9:15 ` [PATCH RFC v3 03/12] fs/configfs: separate out configfs_{link,unlink}_root() Hannes Reinecke
2026-06-23  9:15 ` [PATCH RFC v3 04/12] fs/configfs: add superblock as attribute to configfs_pin_fs() Hannes Reinecke
2026-06-23  9:15 ` [PATCH RFC v3 05/12] fs/configfs: add 'fill_subsystem' and 'clear_subsystem' callbacks Hannes Reinecke
2026-06-23  9:15 ` [PATCH RFC v3 06/12] fs/namespace: implement mnt_clone_direct() Hannes Reinecke
2026-06-23  9:15 ` [PATCH RFC v3 07/12] fs/configfs: switch to get_tree_keyed() Hannes Reinecke
2026-06-23  9:15 ` [PATCH RFC v3 08/12] fs/configfs: open-code simple_pin_fs() Hannes Reinecke
2026-06-23  9:15 ` [PATCH RFC v3 09/12] nvmet: make discovery subsystem dynamic Hannes Reinecke
2026-06-23  9:15 ` [PATCH RFC v3 10/12] nvmet: per net-namespace port list Hannes Reinecke
2026-06-23  9:15 ` [PATCH RFC v3 11/12] nvmet: make configfs setup namespace aware Hannes Reinecke
2026-06-23  9:15 ` [PATCH RFC v3 12/12] nvmet: enable transports for net namespaces Hannes Reinecke
2026-06-23 14:37 ` [syzbot ci] Re: namespace-aware configfs syzbot ci

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox