chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
timedated: move sources to subdirectory
[elogind.git]
/
src
/
cgroup.c
diff --git
a/src/cgroup.c
b/src/cgroup.c
index a3491582be316428d91605f9654a2f4c2df76274..4bbb54fd7e41a17f96ea8f3b651cc43aa8e5f089 100644
(file)
--- a/
src/cgroup.c
+++ b/
src/cgroup.c
@@
-38,17
+38,14
@@
int cgroup_bonding_realize(CGroupBonding *b) {
assert(b->path);
assert(b->controller);
assert(b->path);
assert(b->controller);
- if (b->realized)
- return 0;
-
- if ((r = cg_create(b->controller, b->path)) < 0)
+ r = cg_create(b->controller, b->path);
+ if (r < 0) {
+ log_warning("Failed to create cgroup %s:%s: %s", b->controller, b->path, strerror(-r));
return r;
return r;
+ }
b->realized = true;
b->realized = true;
- if (b->ours)
- cg_trim(b->controller, b->path, false);
-
return 0;
}
return 0;
}
@@
-189,7
+186,7
@@
int cgroup_bonding_kill(CGroupBonding *b, int sig, bool sigcont, Set *s) {
assert(sig >= 0);
/* Don't kill cgroups that aren't ours */
assert(sig >= 0);
/* Don't kill cgroups that aren't ours */
- if (!b->
realized || !b->
ours)
+ if (!b->ours)
return 0;
return cg_kill_recursive(b->controller, b->path, sig, sigcont, true, false, s);
return 0;
return cg_kill_recursive(b->controller, b->path, sig, sigcont, true, false, s);
@@
-270,7
+267,7
@@
int manager_setup_cgroup(Manager *m) {
assert(m);
/* 0. Be nice to Ingo Molnar #628004 */
assert(m);
/* 0. Be nice to Ingo Molnar #628004 */
- if (path_is_mount_point("/sys/fs/cgroup/systemd") <= 0) {
+ if (path_is_mount_point("/sys/fs/cgroup/systemd"
, false
) <= 0) {
log_warning("No control group support available, not creating root group.");
return 0;
}
log_warning("No control group support available, not creating root group.");
return 0;
}
@@
-366,7
+363,8
@@
int cgroup_notify_empty(Manager *m, const char *group) {
assert(m);
assert(group);
assert(m);
assert(group);
- if (!(l = hashmap_get(m->cgroup_bondings, group)))
+ l = hashmap_get(m->cgroup_bondings, group);
+ if (!l)
return 0;
LIST_FOREACH(by_path, b, l) {
return 0;
LIST_FOREACH(by_path, b, l) {
@@
-375,7
+373,8
@@
int cgroup_notify_empty(Manager *m, const char *group) {
if (!b->unit)
continue;
if (!b->unit)
continue;
- if ((t = cgroup_bonding_is_empty_list(b)) < 0) {
+ t = cgroup_bonding_is_empty_list(b);
+ if (t < 0) {
/* If we don't know, we don't know */
if (t != -EAGAIN)
/* If we don't know, we don't know */
if (t != -EAGAIN)
@@
-384,9
+383,13
@@
int cgroup_notify_empty(Manager *m, const char *group) {
continue;
}
continue;
}
- if (t > 0)
+ if (t > 0) {
+ /* If it is empty, let's delete it */
+ cgroup_bonding_trim_list(b->unit->meta.cgroup_bondings, true);
+
if (UNIT_VTABLE(b->unit)->cgroup_notify_empty)
UNIT_VTABLE(b->unit)->cgroup_notify_empty(b->unit);
if (UNIT_VTABLE(b->unit)->cgroup_notify_empty)
UNIT_VTABLE(b->unit)->cgroup_notify_empty(b->unit);
+ }
}
return 0;
}
return 0;