static int sysfs_fill_super(struct super_block *sb)
{
+ struct sysfs_super_info *info = sysfs_info(sb);
struct inode *inode;
struct dentry *root;
/* get root inode, initialize and unlock it */
mutex_lock(&sysfs_mutex);
- inode = sysfs_get_inode(sb, sysfs_root_sd);
+ inode = sysfs_get_inode(sb, info->root->sd);
mutex_unlock(&sysfs_mutex);
if (!inode) {
pr_debug("sysfs: could not get root inode\n");
pr_debug("%s: could not get root dentry!\n", __func__);
return -ENOMEM;
}
- kernfs_get(sysfs_root_sd);
- root->d_fsdata = sysfs_root_sd;
+ kernfs_get(info->root->sd);
+ root->d_fsdata = info->root->sd;
sb->s_root = root;
sb->s_d_op = &sysfs_dentry_ops;
return 0;
struct sysfs_super_info *sb_info = sysfs_info(sb);
struct sysfs_super_info *info = data;
- return sb_info->ns == info->ns;
+ return sb_info->root == info->root && sb_info->ns == info->ns;
}
static int sysfs_set_super(struct super_block *sb, void *data)
if (!info)
return ERR_PTR(-ENOMEM);
+ info->root = sysfs_root;
info->ns = kobj_ns_grab_current(KOBJ_NS_TYPE_NET);
sb = sget(fs_type, sysfs_test_super, sysfs_set_super, flags, info);
*/
struct sysfs_super_info {
+ /*
+ * The root associated with this super_block. Each super_block is
+ * identified by the root and ns it's associated with.
+ */
+ struct kernfs_root *root;
+
/*
* Each sb is associated with one namespace tag, currently the network
* namespace of the task which mounted this sysfs instance. If multiple