All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH cgroup/for-4.3 1/3] cgroup: replace error handling in cgroup_init() with WARN_ON()s
@ 2015-08-05 17:20 ` Tejun Heo
  0 siblings, 0 replies; 12+ messages in thread
From: Tejun Heo @ 2015-08-05 17:20 UTC (permalink / raw)
  To: Li Zefan, Johannes Weiner
  Cc: cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, kernel-team-b10kYP2dOMg

The init sequence shouldn't fail short of bugs and even when it does
it's better to continue with the rest of initialization and we were
silently ignoring /proc/cgroups creation failure.

Drop the explicit error handling and wrap sysfs_create_mount_point(),
register_filesystem() and proc_create() with WARN_ON()s.

Signed-off-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Cc: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
---
 kernel/cgroup.c |   15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -5014,7 +5014,7 @@ int __init cgroup_init(void)
 {
 	struct cgroup_subsys *ss;
 	unsigned long key;
-	int ssid, err;
+	int ssid;
 
 	BUG_ON(percpu_init_rwsem(&cgroup_threadgroup_rwsem));
 	BUG_ON(cgroup_init_cftypes(NULL, cgroup_dfl_base_files));
@@ -5072,17 +5072,10 @@ int __init cgroup_init(void)
 			ss->bind(init_css_set.subsys[ssid]);
 	}
 
-	err = sysfs_create_mount_point(fs_kobj, "cgroup");
-	if (err)
-		return err;
-
-	err = register_filesystem(&cgroup_fs_type);
-	if (err < 0) {
-		sysfs_remove_mount_point(fs_kobj, "cgroup");
-		return err;
-	}
+	WARN_ON(sysfs_create_mount_point(fs_kobj, "cgroup"));
+	WARN_ON(register_filesystem(&cgroup_fs_type));
+	WARN_ON(!proc_create("cgroups", 0, NULL, &proc_cgroupstats_operations));
 
-	proc_create("cgroups", 0, NULL, &proc_cgroupstats_operations);
 	return 0;
 }
 

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

end of thread, other threads:[~2015-10-15 20:59 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-05 17:20 [PATCH cgroup/for-4.3 1/3] cgroup: replace error handling in cgroup_init() with WARN_ON()s Tejun Heo
2015-08-05 17:20 ` Tejun Heo
     [not found] ` <20150805172012.GO17598-qYNAdHglDFBN0TnZuCh8vA@public.gmane.org>
2015-08-05 17:20   ` [PATCH cgroup/for-4.3 2/3] cgroup: drop cgroup__DEVEL__legacy_files_on_dfl Tejun Heo
2015-08-05 17:20     ` Tejun Heo
     [not found]     ` <20150805172043.GP17598-qYNAdHglDFBN0TnZuCh8vA@public.gmane.org>
2015-08-05 17:21       ` [PATCH cgroup/for-4.3 3/3] cgroup: replace __DEVEL__sane_behavior with cgroup2 fs type Tejun Heo
2015-08-05 17:21         ` Tejun Heo
2015-08-10 10:19         ` Zefan Li
2015-08-10 10:19           ` Zefan Li
2015-10-15 20:59       ` [PATCH cgroup/for-4.3 2/3] cgroup: drop cgroup__DEVEL__legacy_files_on_dfl Tejun Heo
2015-10-15 20:59         ` Tejun Heo
2015-08-10 10:19 ` [PATCH cgroup/for-4.3 1/3] cgroup: replace error handling in cgroup_init() with WARN_ON()s Zefan Li
2015-08-10 10:19   ` Zefan Li

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.