[PATCH RFC v3 04/12] fs/configfs: add superblock as attribute to configfs_pin_fs()
Hannes Reinecke
hare at kernel.org
Tue Jun 23 02:15:49 PDT 2026
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 at kernel.org>
---
fs/configfs/configfs_internal.h | 4 ++--
fs/configfs/dir.c | 10 +++++-----
fs/configfs/mount.c | 20 +++++++++++++-------
3 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/fs/configfs/configfs_internal.h b/fs/configfs/configfs_internal.h
index 94b9e306709150e7a123c46bb359077c6dc917ad..a4f10dd8ce0f46873d2053860a9fd25f3ee4c809 100644
--- a/fs/configfs/configfs_internal.h
+++ b/fs/configfs/configfs_internal.h
@@ -90,8 +90,8 @@ extern const unsigned char * configfs_get_name(struct configfs_dirent *sd);
extern int configfs_setattr(struct mnt_idmap *idmap,
struct dentry *dentry, struct iattr *iattr);
-extern struct dentry *configfs_pin_fs(void);
-extern void configfs_release_fs(void);
+extern struct dentry *configfs_pin_fs(struct super_block *sb);
+extern void configfs_release_fs(struct super_block *sb);
extern struct configfs_super_info *configfs_get_super_info(struct net *net_ns);
extern void configfs_put_super_info(struct configfs_super_info *info);
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index ffd0e302cff1756f2161bdb58f1d8c1ac0cf893a..64635c58c0f33ec2d722b0555d3a9153f28bb200 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -1144,7 +1144,7 @@ int configfs_depend_item(struct configfs_subsystem *subsys,
* Pin the configfs filesystem. This means we can safely access
* the root of the configfs filesystem.
*/
- root = configfs_pin_fs();
+ root = configfs_pin_fs(NULL);
if (IS_ERR(root))
return PTR_ERR(root);
@@ -1171,7 +1171,7 @@ int configfs_depend_item(struct configfs_subsystem *subsys,
* If we succeeded, the fs is pinned via other methods. If not,
* we're done with it anyway. So release_fs() is always right.
*/
- configfs_release_fs();
+ configfs_release_fs(NULL);
return ret;
}
@@ -1926,7 +1926,7 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
if (WARN_ON(IS_ERR(info)))
return PTR_ERR(info);
- root = configfs_pin_fs();
+ root = configfs_pin_fs(NULL);
if (IS_ERR(root)) {
err = PTR_ERR(root);
goto out_put;
@@ -1934,7 +1934,7 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
err = configfs_link_root(info, subsys, root);
if (err)
- configfs_release_fs();
+ configfs_release_fs(NULL);
out_put:
configfs_put_super_info(info);
@@ -2000,7 +2000,7 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys)
mutex_lock(&info->subsys_mutex);
unlink_group(group);
mutex_unlock(&info->subsys_mutex);
- configfs_release_fs();
+ configfs_release_fs(NULL);
configfs_put_super_info(info);
}
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index 067bb1099a52ca2216d1b2881429a3fd1811c706..8b26ceb7b0d4a03a17c251de42902aaabef5a652 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -192,18 +192,24 @@ static struct file_system_type configfs_fs_type = {
};
MODULE_ALIAS_FS("configfs");
-struct dentry *configfs_pin_fs(void)
+struct dentry *configfs_pin_fs(struct super_block *sb)
{
- int err = simple_pin_fs(&configfs_fs_type, &configfs_root->mnt,
- &configfs_root->mnt_count);
- return err ? ERR_PTR(err) : configfs_root->mnt->mnt_root;
+ struct configfs_super_info *info = configfs_root;
+ int err;
+
+ err = simple_pin_fs(&configfs_fs_type, &info->mnt, &info->mnt_count);
+ if (err)
+ return ERR_PTR(err);
+
+ return info->mnt->mnt_root;
}
-void configfs_release_fs(void)
+void configfs_release_fs(struct super_block *sb)
{
- simple_release_fs(&configfs_root->mnt, &configfs_root->mnt_count);
-}
+ struct configfs_super_info *info = configfs_root;
+ simple_release_fs(&info->mnt, &info->mnt_count);
+}
static int __init configfs_init(void)
{
--
2.51.0
More information about the Linux-nvme
mailing list