Merge lp:~xnox/upstart/fix-user-cgroup into lp:upstart/async

Proposed by Dimitri John Ledkov
Status: Merged
Merged at revision: 1663
Proposed branch: lp:~xnox/upstart/fix-user-cgroup
Merge into: lp:upstart/async
Diff against target: 56 lines (+22/-17)
1 file modified
init/cgroup.c (+22/-17)
To merge this branch: bzr merge lp:~xnox/upstart/fix-user-cgroup
Reviewer Review Type Date Requested Status
James Hunt Approve
Review via email: mp+222068@code.launchpad.net
To post a comment you must log in.
Revision history for this message
James Hunt (jamesodhunt) wrote :

LGTM.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'init/cgroup.c'
2--- init/cgroup.c 2014-06-02 22:19:01 +0000
3+++ init/cgroup.c 2014-06-04 16:15:49 +0000
4@@ -54,6 +54,8 @@
5
6 #include <cgmanager/cgmanager-client.h>
7
8+extern int user_mode;
9+
10 /**
11 * disable_cgroups:
12 *
13@@ -1061,23 +1063,26 @@
14 nih_assert (path);
15 nih_assert (cgroup_manager);
16
17- pid = getpid ();
18-
19- /* Escape our existing cgroup for this controller by moving to
20- * the root cgroup to avoid creating groups below the current
21- * cgroup.
22- */
23- ret = cgmanager_move_pid_abs_sync (NULL,
24- cgroup_manager,
25- controller,
26- UPSTART_CGROUP_ROOT,
27- pid);
28-
29- if (ret < 0)
30- return FALSE;
31-
32- nih_debug ("Moved pid %d to root of '%s' controller cgroup",
33- pid, controller);
34+ if (!user_mode) {
35+ pid = getpid ();
36+
37+ /* Escape our existing cgroup for this controller by moving to
38+ * the root cgroup to avoid creating groups below the current
39+ * cgroup.
40+ */
41+ ret = cgmanager_move_pid_abs_sync (NULL,
42+ cgroup_manager,
43+ controller,
44+ UPSTART_CGROUP_ROOT,
45+ pid);
46+
47+
48+ if (ret < 0)
49+ return FALSE;
50+
51+ nih_debug ("Moved pid %d to root of '%s' controller cgroup",
52+ pid, controller);
53+ }
54
55
56 /* Ask cgmanager to create the cgroup */

Subscribers

People subscribed via source and target branches