aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/kernfs/mount.c11
-rw-r--r--fs/sysfs/mount.c4
-rw-r--r--include/linux/kernfs.h13
-rw-r--r--kernel/cgroup.c4
4 files changed, 20 insertions, 12 deletions
diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c
index 6a5f04ac8704..95dcd1d558bb 100644
--- a/fs/kernfs/mount.c
+++ b/fs/kernfs/mount.c
@@ -62,7 +62,7 @@ struct kernfs_root *kernfs_root_from_sb(struct super_block *sb)
62 return NULL; 62 return NULL;
63} 63}
64 64
65static int kernfs_fill_super(struct super_block *sb) 65static int kernfs_fill_super(struct super_block *sb, unsigned long magic)
66{ 66{
67 struct kernfs_super_info *info = kernfs_info(sb); 67 struct kernfs_super_info *info = kernfs_info(sb);
68 struct inode *inode; 68 struct inode *inode;
@@ -70,7 +70,7 @@ static int kernfs_fill_super(struct super_block *sb)
70 70
71 sb->s_blocksize = PAGE_CACHE_SIZE; 71 sb->s_blocksize = PAGE_CACHE_SIZE;
72 sb->s_blocksize_bits = PAGE_CACHE_SHIFT; 72 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
73 sb->s_magic = SYSFS_MAGIC; 73 sb->s_magic = magic;
74 sb->s_op = &kernfs_sops; 74 sb->s_op = &kernfs_sops;
75 sb->s_time_gran = 1; 75 sb->s_time_gran = 1;
76 76
@@ -131,6 +131,7 @@ const void *kernfs_super_ns(struct super_block *sb)
131 * @fs_type: file_system_type of the fs being mounted 131 * @fs_type: file_system_type of the fs being mounted
132 * @flags: mount flags specified for the mount 132 * @flags: mount flags specified for the mount
133 * @root: kernfs_root of the hierarchy being mounted 133 * @root: kernfs_root of the hierarchy being mounted
134 * @magic: file system specific magic number
134 * @new_sb_created: tell the caller if we allocated a new superblock 135 * @new_sb_created: tell the caller if we allocated a new superblock
135 * @ns: optional namespace tag of the mount 136 * @ns: optional namespace tag of the mount
136 * 137 *
@@ -142,8 +143,8 @@ const void *kernfs_super_ns(struct super_block *sb)
142 * The return value can be passed to the vfs layer verbatim. 143 * The return value can be passed to the vfs layer verbatim.
143 */ 144 */
144struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, 145struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags,
145 struct kernfs_root *root, bool *new_sb_created, 146 struct kernfs_root *root, unsigned long magic,
146 const void *ns) 147 bool *new_sb_created, const void *ns)
147{ 148{
148 struct super_block *sb; 149 struct super_block *sb;
149 struct kernfs_super_info *info; 150 struct kernfs_super_info *info;
@@ -166,7 +167,7 @@ struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags,
166 *new_sb_created = !sb->s_root; 167 *new_sb_created = !sb->s_root;
167 168
168 if (!sb->s_root) { 169 if (!sb->s_root) {
169 error = kernfs_fill_super(sb); 170 error = kernfs_fill_super(sb, magic);
170 if (error) { 171 if (error) {
171 deactivate_locked_super(sb); 172 deactivate_locked_super(sb);
172 return ERR_PTR(error); 173 return ERR_PTR(error);
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index 8794423f7efb..8a49486bf30c 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -13,6 +13,7 @@
13#define DEBUG 13#define DEBUG
14 14
15#include <linux/fs.h> 15#include <linux/fs.h>
16#include <linux/magic.h>
16#include <linux/mount.h> 17#include <linux/mount.h>
17#include <linux/init.h> 18#include <linux/init.h>
18#include <linux/user_namespace.h> 19#include <linux/user_namespace.h>
@@ -38,7 +39,8 @@ static struct dentry *sysfs_mount(struct file_system_type *fs_type,
38 } 39 }
39 40
40 ns = kobj_ns_grab_current(KOBJ_NS_TYPE_NET); 41 ns = kobj_ns_grab_current(KOBJ_NS_TYPE_NET);
41 root = kernfs_mount_ns(fs_type, flags, sysfs_root, &new_sb, ns); 42 root = kernfs_mount_ns(fs_type, flags, sysfs_root,
43 SYSFS_MAGIC, &new_sb, ns);
42 if (IS_ERR(root) || !new_sb) 44 if (IS_ERR(root) || !new_sb)
43 kobj_ns_drop(KOBJ_NS_TYPE_NET, ns); 45 kobj_ns_drop(KOBJ_NS_TYPE_NET, ns);
44 return root; 46 return root;
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index ca1be5c9136c..52bf5677db0b 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -297,8 +297,8 @@ void kernfs_notify(struct kernfs_node *kn);
297 297
298const void *kernfs_super_ns(struct super_block *sb); 298const void *kernfs_super_ns(struct super_block *sb);
299struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, 299struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags,
300 struct kernfs_root *root, bool *new_sb_created, 300 struct kernfs_root *root, unsigned long magic,
301 const void *ns); 301 bool *new_sb_created, const void *ns);
302void kernfs_kill_sb(struct super_block *sb); 302void kernfs_kill_sb(struct super_block *sb);
303 303
304void kernfs_init(void); 304void kernfs_init(void);
@@ -391,7 +391,8 @@ static inline const void *kernfs_super_ns(struct super_block *sb)
391 391
392static inline struct dentry * 392static inline struct dentry *
393kernfs_mount_ns(struct file_system_type *fs_type, int flags, 393kernfs_mount_ns(struct file_system_type *fs_type, int flags,
394 struct kernfs_root *root, bool *new_sb_created, const void *ns) 394 struct kernfs_root *root, unsigned long magic,
395 bool *new_sb_created, const void *ns)
395{ return ERR_PTR(-ENOSYS); } 396{ return ERR_PTR(-ENOSYS); }
396 397
397static inline void kernfs_kill_sb(struct super_block *sb) { } 398static inline void kernfs_kill_sb(struct super_block *sb) { }
@@ -449,9 +450,11 @@ static inline int kernfs_rename(struct kernfs_node *kn,
449 450
450static inline struct dentry * 451static inline struct dentry *
451kernfs_mount(struct file_system_type *fs_type, int flags, 452kernfs_mount(struct file_system_type *fs_type, int flags,
452 struct kernfs_root *root, bool *new_sb_created) 453 struct kernfs_root *root, unsigned long magic,
454 bool *new_sb_created)
453{ 455{
454 return kernfs_mount_ns(fs_type, flags, root, new_sb_created, NULL); 456 return kernfs_mount_ns(fs_type, flags, root,
457 magic, new_sb_created, NULL);
455} 458}
456 459
457#endif /* __LINUX_KERNFS_H */ 460#endif /* __LINUX_KERNFS_H */
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 3f1ca934a237..ceee0c54c6a4 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -33,6 +33,7 @@
33#include <linux/init_task.h> 33#include <linux/init_task.h>
34#include <linux/kernel.h> 34#include <linux/kernel.h>
35#include <linux/list.h> 35#include <linux/list.h>
36#include <linux/magic.h>
36#include <linux/mm.h> 37#include <linux/mm.h>
37#include <linux/mutex.h> 38#include <linux/mutex.h>
38#include <linux/mount.h> 39#include <linux/mount.h>
@@ -1604,7 +1605,8 @@ out_unlock:
1604 if (ret) 1605 if (ret)
1605 return ERR_PTR(ret); 1606 return ERR_PTR(ret);
1606 1607
1607 dentry = kernfs_mount(fs_type, flags, root->kf_root, &new_sb); 1608 dentry = kernfs_mount(fs_type, flags, root->kf_root,
1609 CGROUP_SUPER_MAGIC, &new_sb);
1608 if (IS_ERR(dentry) || !new_sb) 1610 if (IS_ERR(dentry) || !new_sb)
1609 cgroup_put(&root->cgrp); 1611 cgroup_put(&root->cgrp);
1610 return dentry; 1612 return dentry;