]> git.pld-linux.org Git - packages/libcgroup.git/blame - libcgroup-0.37.1-systemd.patch
- new cgroup
[packages/libcgroup.git] / libcgroup-0.37.1-systemd.patch
CommitLineData
25379cc3
AM
1702111 - Starting LSB: start and stop the WLM configuration failed
2
3 - cgconfigparser should not unmount stuff it did not mounted
4 - cgconfigparser should accept empty config file
5 - rename the service
6
7Backported these 3 pacthes:
8
9commit 7155cc27430619be5ffcf1ddc2b6bd8cf7d6d7e0
10Author: Dhaval Giani <dhaval.giani@gmail.com>
11Date: Fri May 27 10:36:19 2011 +0200
12
13 cgconfig: Do not touch subsystems not mounted by cgconfig
14
15 cgconfig: Do not touch subsystems not mounted by cgconfig
16
17 In its failure path, cgconfig should only touch the subsystems
18 it had something to do with. Currently, it unmounts all the
19 subsystems in the config file. Correct this.
20
21 Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
22 Signed-off-by: Jan Safranek <jsafrane@redhat.com>
23
24commit 431587f4e21b36a3f08bc595d716a70d70314e70
25Author: Jan Safranek <jsafrane@redhat.com>
26Date: Fri May 20 15:53:05 2011 +0200
27
28 Updated cgconfig service descriptions
29
30 Signed-off-by: Jan Safranek <jsafrane@redhat.com>
31
32commit 74e1b1e3d04c2f7999e367a20bf73396b61f9b64
33Author: Jan Safranek <jsafrane@redhat.com>
34Date: Fri May 20 15:52:58 2011 +0200
35
36 Fixed cgconfigparser to allow configs with no 'mount' section
37
38 cgconfig service fails when something else mounts cgroup hierarchies during
39 boot (e.g. systemd). Therefore we should allow cgconfig.conf to have no
40 'mount' section -> it's up to admin to ensure that controllers are mounted as
41 needed.
42
43 Because 'group' section is already optional, with this patch cgconfigparser
44 will accept empty configuration file. This is probably the best default
45 config for distros with systemd.
46
47 Changelog:
48 - fixed case with empty config file and no mounted controllers
49 - reworked the if conditions to be more clear
50
51 Signed-off-by: Jan Safranek <jsafrane@redhat.com>
52
53diff -up libcgroup-0.37.1/doc/man/cgconfig.conf.5.systemd2 libcgroup-0.37.1/doc/man/cgconfig.conf.5
54--- libcgroup-0.37.1/doc/man/cgconfig.conf.5.systemd2 2011-03-03 09:29:41.000000000 +0100
55+++ libcgroup-0.37.1/doc/man/cgconfig.conf.5 2011-05-30 15:06:45.083249011 +0200
56@@ -12,8 +12,8 @@ The file consists of
57 .I mount
58 and
59 .I group
60-sections. These sections can be in arbitrary order. Any line starting with
61-'#' is considered as a comment line and is ignored.
62+sections. These sections can be in arbitrary order and both are optional.
63+Any line starting with '#' is considered as a comment line and is ignored.
64 .LP
65 .I mount
66 section has this form:
67@@ -50,6 +50,11 @@ controller, shall be mounted. The direct
68 automatically on cgconfig service startup if it does not exist and
69 is deleted on service shutdown.
70 .LP
71+
72+If no
73+.I mount
74+section is specified, no controllers are mounted.
75+
76 .I group
77 section has this form:
78 .RS
79@@ -171,6 +176,10 @@ created. Optionally it can be enclosed i
80 contain spaces then.
81 .RE
82
83+If no
84+.I group
85+section is specified, no groups are created.
86+
87 .\"********************************************"
88 .SH EXAMPLES
89 .LP
90diff -up libcgroup-0.37.1/scripts/init.d/cgconfig.in.systemd2 libcgroup-0.37.1/scripts/init.d/cgconfig.in
91--- libcgroup-0.37.1/scripts/init.d/cgconfig.in.systemd2 2011-05-30 15:00:36.269947252 +0200
92+++ libcgroup-0.37.1/scripts/init.d/cgconfig.in 2011-05-30 15:00:36.284946695 +0200
93@@ -25,8 +25,8 @@
94 # Required-Stop:
95 # Should-Start:
96 # Should-Stop:
97-# Short-Description: start and stop the WLM configuration
98-# Description: This script allows us to create a default configuration
99+# Short-Description: Create and setup control group filesystem(s)
100+# Description: Create and setup control group filesystem(s)
101 ### END INIT INFO
102
103 # get correct location of binaries from configure
104diff -up libcgroup-0.37.1/src/config.c.systemd2 libcgroup-0.37.1/src/config.c
105--- libcgroup-0.37.1/src/config.c.systemd2 2011-03-03 09:29:41.000000000 +0100
106+++ libcgroup-0.37.1/src/config.c 2011-05-30 15:17:08.317101247 +0200
107@@ -394,6 +394,7 @@ static int cgroup_config_mount_fs(void)
108 int ret;
109 struct stat buff;
110 int i;
111+ int error;
112
113 for (i = 0; i < config_table_index; i++) {
114 struct cg_mount_table_s *curr = &(config_mount_table[i]);
115@@ -402,26 +403,39 @@ static int cgroup_config_mount_fs(void)
116
117 if (ret < 0 && errno != ENOENT) {
118 last_errno = errno;
119- return ECGOTHER;
120+ error = ECGOTHER;
121+ goto out_err;
122 }
123
124 if (errno == ENOENT) {
125 ret = cg_mkdir_p(curr->path);
126- if (ret)
127- return ret;
128+ if (ret) {
129+ error = ret;
130+ goto out_err;
131+ }
132 } else if (!S_ISDIR(buff.st_mode)) {
133 errno = ENOTDIR;
134 last_errno = errno;
135- return ECGOTHER;
136+ error = ECGOTHER;
137+ goto out_err;
138 }
139
140 ret = mount(CGROUP_FILESYSTEM, curr->path, CGROUP_FILESYSTEM,
141 0, curr->name);
142
143- if (ret < 0)
144- return ECGMOUNTFAIL;
145+ if (ret < 0) {
146+ error = ECGMOUNTFAIL;
147+ goto out_err;
148+ }
149 }
150 return 0;
151+out_err:
152+ /*
153+ * If we come here, we have failed. Since we have touched only
154+ * mountpoints prior to i, we shall operate on only them now.
155+ */
156+ config_table_index = 1;
157+ return error;
158 }
159
160 /*
161@@ -681,24 +695,25 @@ int cgroup_config_load_config(const char
162 mount_enabled = (config_mount_table[0].name[0] != '\0');
163
164 /*
165- * The configuration should have either namespace or mount.
166- * Not both and not none.
167+ * The configuration should have namespace or mount, not both.
168 */
169- if (namespace_enabled == mount_enabled) {
170+ if (namespace_enabled && mount_enabled) {
171 free(config_cgroup_table);
172 return ECGMOUNTNAMESPACE;
173 }
174
175- /*
176- * We do not allow both mount and namespace sections in the
177- * same configuration file. So test for that
178- */
179-
180 error = cgroup_config_mount_fs();
181 if (error)
182 goto err_mnt;
183
184 error = cgroup_init();
185+ if (error == ECGROUPNOTMOUNTED && cgroup_table_index == 0) {
186+ /*
187+ * The config file seems to be empty.
188+ */
189+ error = 0;
190+ goto err_mnt;
191+ }
192 if (error)
193 goto err_mnt;
194
This page took 0.170698 seconds and 4 git commands to generate.