All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cgroupfs: create /sys/fs/cgroup to mount cgroupfs on
@ 2010-07-22 18:26 Greg KH
  2010-07-22 18:31 ` Paul Menage
       [not found] ` <20100722182638.GA12712-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
  0 siblings, 2 replies; 71+ messages in thread
From: Greg KH @ 2010-07-22 18:26 UTC (permalink / raw)
  To: Paul Menage, Li Zefan
  Cc: Lennart Poettering, Kay Sievers, Andrew Morton, KAMEZAWA Hiroyuki,
	Ben Blum, containers, linux-kernel

We really shouldn't be asking userspace to create new root filesystems.
So follow along with all of the other in-kernel filesystems, and provide
a mount point in sysfs.

For cgroupfs, this should be in /sys/fs/cgroup/  This change provides
that mount point when the cgroup filesystem is registered in the kernel.

Cc: Paul Menage <menage@google.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: Lennart Poettering <lennart@poettering.net>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1623,6 +1623,8 @@ static struct file_system_type cgroup_fs_type = {
 	.kill_sb = cgroup_kill_sb,
 };
 
+static struct kobject *cgroup_kobj;
+
 static inline struct cgroup *__d_cgrp(struct dentry *dentry)
 {
 	return dentry->d_fsdata;
@@ -3871,9 +3873,18 @@ int __init cgroup_init(void)
 	hhead = css_set_hash(init_css_set.subsys);
 	hlist_add_head(&init_css_set.hlist, hhead);
 	BUG_ON(!init_root_id(&rootnode));
+
+	cgroup_kobj = kobject_create_and_add("cgroup", fs_kobj);
+	if (!cgroup_kobj) {
+		err = -ENOMEM;
+		goto out;
+	}
+
 	err = register_filesystem(&cgroup_fs_type);
-	if (err < 0)
+	if (err < 0) {
+		kobject_put(cgroup_kobj);
 		goto out;
+	}
 
 	proc_create("cgroups", 0, NULL, &proc_cgroupstats_operations);
 

^ permalink raw reply	[flat|nested] 71+ messages in thread
* [PATCH] cgroupfs: create /sys/fs/cgroup to mount cgroupfs on
@ 2010-07-22 18:26 Greg KH
  0 siblings, 0 replies; 71+ messages in thread
From: Greg KH @ 2010-07-22 18:26 UTC (permalink / raw)
  To: Paul Menage, Li Zefan
  Cc: Ben Blum, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Kay Sievers, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	Lennart Poettering, Andrew Morton

We really shouldn't be asking userspace to create new root filesystems.
So follow along with all of the other in-kernel filesystems, and provide
a mount point in sysfs.

For cgroupfs, this should be in /sys/fs/cgroup/  This change provides
that mount point when the cgroup filesystem is registered in the kernel.

Cc: Paul Menage <menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Cc: Li Zefan <lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
Cc: Lennart Poettering <lennart-mdGvqq1h2p+GdvJs77BJ7Q@public.gmane.org>
Cc: Kay Sievers <kay.sievers-tD+1rO4QERM@public.gmane.org>
Signed-off-by: Greg Kroah-Hartman <gregkh-l3A5Bk7waGM@public.gmane.org>

--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1623,6 +1623,8 @@ static struct file_system_type cgroup_fs_type = {
 	.kill_sb = cgroup_kill_sb,
 };
 
+static struct kobject *cgroup_kobj;
+
 static inline struct cgroup *__d_cgrp(struct dentry *dentry)
 {
 	return dentry->d_fsdata;
@@ -3871,9 +3873,18 @@ int __init cgroup_init(void)
 	hhead = css_set_hash(init_css_set.subsys);
 	hlist_add_head(&init_css_set.hlist, hhead);
 	BUG_ON(!init_root_id(&rootnode));
+
+	cgroup_kobj = kobject_create_and_add("cgroup", fs_kobj);
+	if (!cgroup_kobj) {
+		err = -ENOMEM;
+		goto out;
+	}
+
 	err = register_filesystem(&cgroup_fs_type);
-	if (err < 0)
+	if (err < 0) {
+		kobject_put(cgroup_kobj);
 		goto out;
+	}
 
 	proc_create("cgroups", 0, NULL, &proc_cgroupstats_operations);

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

end of thread, other threads:[~2010-07-26 22:18 UTC | newest]

Thread overview: 71+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-22 18:26 [PATCH] cgroupfs: create /sys/fs/cgroup to mount cgroupfs on Greg KH
2010-07-22 18:31 ` Paul Menage
     [not found]   ` <AANLkTinRGBksuWAZhdmvr39FNACU18+kc5ut49VUf=mp-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-22 18:36     ` Greg KH
2010-07-22 18:36   ` Greg KH
2010-07-22 18:44     ` Paul Menage
     [not found]       ` <AANLkTimbcuzH6_bBhYX0U6vqftYgRwE0ZTmcbaRNzXef-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-22 18:53         ` Greg KH
2010-07-22 18:53       ` Greg KH
     [not found]         ` <20100722185301.GA528-l3A5Bk7waGM@public.gmane.org>
2010-07-22 19:07           ` Paul Menage
2010-07-22 19:07         ` Paul Menage
2010-07-22 19:12           ` Greg KH
2010-07-22 19:18             ` Paul Menage
     [not found]               ` <AANLkTi=8TTeGG3OTbP4zzNAe_rDaNNL8D0Yxp7DixohK-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-22 21:19                 ` Greg KH
2010-07-22 21:19               ` Greg KH
2010-07-22 23:12                 ` Paul Menage
2010-07-22 23:20                   ` Greg KH
     [not found]                   ` <AANLkTimwUC_ToxADRR9n5_KLFVHgL=ymMngXAyt+OboJ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-22 23:20                     ` Greg KH
     [not found]                 ` <20100722211958.GB1297-l3A5Bk7waGM@public.gmane.org>
2010-07-22 23:12                   ` Paul Menage
2010-07-22 21:48             ` Matt Helsley
     [not found]               ` <20100722214821.GB14303-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2010-07-22 23:10                 ` Kay Sievers
2010-07-22 23:10               ` Kay Sievers
2010-07-23 20:21                 ` Matt Helsley
     [not found]                 ` <AANLkTikluqTBi3XsU-OT_IJuBdkURkHpM3ut-8ratnzr-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-23 20:21                   ` Matt Helsley
     [not found]             ` <20100722191200.GA5609-l3A5Bk7waGM@public.gmane.org>
2010-07-22 19:18               ` Paul Menage
2010-07-22 21:48               ` Matt Helsley
     [not found]           ` <AANLkTik07hZot_x0p7xJuY8s4f8pGRd2Mn1+jYfHH2iq-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-22 19:12             ` Greg KH
     [not found]     ` <20100722183614.GA5443-l3A5Bk7waGM@public.gmane.org>
2010-07-22 18:44       ` Paul Menage
2010-07-22 19:37       ` Vivek Goyal
2010-07-22 19:37     ` Vivek Goyal
     [not found]       ` <20100722193741.GA2688-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-07-22 21:18         ` Greg KH
2010-07-22 21:18       ` Greg KH
2010-07-22 21:26         ` Vivek Goyal
2010-07-22 23:35           ` Greg KH
     [not found]           ` <20100722212634.GC2688-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-07-22 23:35             ` Greg KH
2010-07-24 14:15             ` Balbir Singh
2010-07-24 14:15           ` Balbir Singh
2010-07-22 23:08         ` Kay Sievers
     [not found]           ` <AANLkTinFQtwrCC82T9KlKskDV8fn-zYgimyH2wguHkqY-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-22 23:14             ` Greg KH
2010-07-22 23:14           ` Greg KH
2010-07-22 23:16             ` Paul Menage
2010-07-22 23:23             ` Kay Sievers
2010-07-23  2:07             ` Vivek Goyal
2010-07-23 10:32               ` Jan Safranek
     [not found]                 ` <4C496FBA.3060009-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-07-23 12:06                   ` Greg KH
2010-07-23 12:06                 ` Greg KH
     [not found]               ` <20100723020714.GA11236-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-07-23 10:32                 ` Jan Safranek
     [not found]             ` <20100722231401.GA11538-l3A5Bk7waGM@public.gmane.org>
2010-07-22 23:16               ` Paul Menage
2010-07-22 23:23               ` Kay Sievers
2010-07-23  2:07               ` Vivek Goyal
     [not found]         ` <20100722211856.GA1297-l3A5Bk7waGM@public.gmane.org>
2010-07-22 21:26           ` Vivek Goyal
2010-07-22 23:08           ` Kay Sievers
2010-07-26  9:08     ` Dhaval Giani
2010-07-26  9:12       ` Kay Sievers
2010-07-26  9:13         ` Dhaval Giani
     [not found]           ` <AANLkTi=OMaKuk+ReeqCfBGes76BjKYyUdqxPOQfH8EcZ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-26 21:28             ` Greg KH
2010-07-26 21:28           ` Greg KH
2010-07-26 21:55             ` Paul Menage
     [not found]               ` <AANLkTimmAfhw7WhPHHU6d4izkzvp2oxOSzNN8JjNu_nU-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-26 22:05                 ` Greg KH
2010-07-26 22:05               ` Greg KH
     [not found]                 ` <20100726220546.GB9671-l3A5Bk7waGM@public.gmane.org>
2010-07-26 22:08                   ` Dhaval Giani
2010-07-26 22:09                   ` Paul Menage
2010-07-26 22:08                 ` Dhaval Giani
2010-07-26 22:17                   ` Greg KH
     [not found]                   ` <AANLkTi=d1-Uf4TeyvMH3evo91zPWjbincij=HC0ny0Ym-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-26 22:17                     ` Greg KH
2010-07-26 22:09                 ` Paul Menage
2010-07-26 22:17                   ` Greg KH
     [not found]                   ` <AANLkTi=Vrax+ob87uiDzeMxOmuDNYUWnDKG0jpfQppAp-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-26 22:17                     ` Greg KH
     [not found]             ` <20100726212858.GA15904-l3A5Bk7waGM@public.gmane.org>
2010-07-26 21:55               ` Paul Menage
     [not found]         ` <AANLkTimm9XGvK2H55V7N76JPU05iHk_dY5JjOLifQTsr-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-26  9:13           ` Dhaval Giani
     [not found]       ` <AANLkTinsd2gWOHb3w9gzvKO5vdwLBT7DZOY+2xCUz_5_-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-26  9:12         ` Kay Sievers
     [not found] ` <20100722182638.GA12712-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2010-07-22 18:31   ` Paul Menage
  -- strict thread matches above, loose matches on Subject: below --
2010-07-22 18:26 Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.