Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@kernel.org>
To: Andreas Hindborg <a.hindborg@kernel.org>,
	 Breno Leitao <leitao@debian.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	 Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	 Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	 Chaitanya Kulkarni <kch@nvidia.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	 linux-nvme@lists.infradead.org,
	Hannes Reinecke <hare@kernel.org>
Subject: [PATCH RFC v2 06/12] fs/configfs: add superblock as attribute to configfs_pin_fs()
Date: Fri, 19 Jun 2026 10:36:46 +0200	[thread overview]
Message-ID: <20260619-configfs-ns-v2-6-82fd7094b8dc@kernel.org> (raw)
In-Reply-To: <20260619-configfs-ns-v2-0-82fd7094b8dc@kernel.org>

Each namspace might have its own superblock, so add it as an argument
to configfs_pin_fs() to ensure that the correct filesystem instance
will be pinned.

Signed-off-by: Hannes Reinecke <hare@kernel.org>
---
 fs/configfs/dir.c        | 16 ++++++++--------
 include/linux/configfs.h |  4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 891238ef0088a98467d6d63a10d633a40fc19c8b..b87b92e3a248dfb091eb52727f06cc4551143f7b 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -1935,7 +1935,7 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
 		INIT_LIST_HEAD(&subsys->su_link);
 		mutex_init(&subsys->su_mutex);
 		config_group_init(&subsys->su_group);
-		err = subsys->fill_subsystem(subsys, info->ns_id);
+		err = subsys->fill_subsystem(subsys, info->net_ns);
 		if (err)
 			goto out_release;
 	}
@@ -1943,7 +1943,7 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
 	err = configfs_link_root(info, subsys, root);
 	if (err) {
 		if (subsys->clear_subsystem)
-			subsys->clear_subsystem(subsys, info->ns_id);
+			subsys->clear_subsystem(subsys, info->net_ns);
 		goto out_release;
 	}
 
@@ -1968,7 +1968,7 @@ void configfs_link_subsystems(struct super_block *sb,
 
 	if (WARN_ON(IS_ERR(parent)))
 		return;
-	if ((info->ns_id == 0) || WARN_ON(parent == info))
+	if ((info->net_ns == &init_net) || WARN_ON(parent == info))
 		return;
 	mutex_lock(&parent->subsys_mutex);
 	list_splice_init(&parent->subsys_list, &subsys_list);
@@ -1987,7 +1987,7 @@ void configfs_link_subsystems(struct super_block *sb,
 		subsys->clear_subsystem = s->clear_subsystem;
 		INIT_LIST_HEAD(&subsys->su_link);
 		mutex_init(&subsys->su_mutex);
-		err = subsys->fill_subsystem(subsys, info->ns_id);
+		err = subsys->fill_subsystem(subsys, info->net_ns);
 		if (err) {
 			kfree(subsys);
 			continue;
@@ -1995,7 +1995,7 @@ void configfs_link_subsystems(struct super_block *sb,
 		root = configfs_pin_fs(sb);
 		if (IS_ERR(root)) {
 			if (subsys->clear_subsystem)
-				subsys->clear_subsystem(subsys, info->ns_id);
+				subsys->clear_subsystem(subsys, info->net_ns);
 			kfree(subsys);
 			continue;
 		}
@@ -2003,7 +2003,7 @@ void configfs_link_subsystems(struct super_block *sb,
 		if (err) {
 			configfs_release_fs(sb);
 			if (subsys->clear_subsystem)
-				subsys->clear_subsystem(subsys, info->ns_id);
+				subsys->clear_subsystem(subsys, info->net_ns);
 			kfree(subsys);
 			continue;
 		}
@@ -2070,7 +2070,7 @@ void configfs_unlink_subsystems(struct super_block *sb,
 		if (!configfs_unlink_root(subsys))
 			continue;
 		if (subsys->clear_subsystem)
-			subsys->clear_subsystem(subsys, info->ns_id);
+			subsys->clear_subsystem(subsys, info->net_ns);
 		unlink_group(&subsys->su_group);
 		configfs_release_fs(sb);
 		kfree(subsys);
@@ -2092,7 +2092,7 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys)
 	mutex_lock(&info->subsys_mutex);
 	list_del_init(&subsys->su_link);
 	if (subsys->clear_subsystem)
-		subsys->clear_subsystem(subsys, info->ns_id);
+		subsys->clear_subsystem(subsys, info->net_ns);
 	unlink_group(group);
 	mutex_unlock(&info->subsys_mutex);
 	configfs_release_fs(NULL);
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index c1cdadba0a48f0abea30da5ee324807b9ac4ff8f..893ae778585fb8be60026c661cb1ef63980ff0e3 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -231,9 +231,9 @@ struct configfs_subsystem {
 	struct config_group	su_group;
 	struct mutex		su_mutex;
 	int (*fill_subsystem)(struct configfs_subsystem *subsys,
-			      u64 ns_id);
+			      struct net *net_ns);
 	void (*clear_subsystem)(struct configfs_subsystem *subsys,
-				u64 ns_id);
+				struct net *net_ns);
 };
 
 static inline struct configfs_subsystem *to_configfs_subsystem(struct config_group *group)

-- 
2.51.0



  parent reply	other threads:[~2026-06-19  8:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-19  8:36 [PATCH RFC v2 00/12] namespace-aware configfs hare
2026-06-19  8:36 ` [PATCH RFC v2 01/12] fs/configfs: rework configfs_is_root() hare
2026-06-19  8:36 ` [PATCH RFC v2 02/12] fs/configfs: dynamically allocate super_info hare
2026-06-19  8:36 ` [PATCH RFC v2 03/12] fs/configfs: separate out configfs_{link,unlink}_root() hare
2026-06-19  8:36 ` [PATCH RFC v2 04/12] fs/configfs: add superblock as attribute to configfs_pin_fs() Hannes Reinecke
2026-06-19  8:36 ` [PATCH RFC v2 05/12] fs/configfs: add 'fill_subsystem' and 'clear_subsystem' callbacks Hannes Reinecke
2026-06-19  8:36 ` Hannes Reinecke [this message]
2026-06-19  8:36 ` [PATCH RFC v2 07/12] fs/namespace: implement mnt_clone_direct() Hannes Reinecke
2026-06-19  8:36 ` [PATCH RFC v2 08/12] fs/configfs: switch to get_tree_keyed() Hannes Reinecke
2026-06-19  8:36 ` [PATCH RFC v2 09/12] fs/configfs: open-code simple_pin_fs() Hannes Reinecke
2026-06-19  8:36 ` [PATCH RFC v2 10/12] nvmet: make discovery subsystem dynamic Hannes Reinecke
2026-06-19  8:36 ` [PATCH RFC v2 11/12] nvmet: per net-namespace port list Hannes Reinecke
2026-06-19  8:36 ` [PATCH RFC v2 12/12] nvmet: make configfs setup namespace aware Hannes Reinecke
2026-06-19 13:25 ` [syzbot ci] Re: namespace-aware configfs syzbot ci

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=20260619-configfs-ns-v2-6-82fd7094b8dc@kernel.org \
    --to=hare@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=brauner@kernel.org \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=kch@nvidia.com \
    --cc=leitao@debian.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=viro@zeniv.linux.org.uk \
    /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