Control: severity -1 serious
Control: tags -1 + patch

Dear Maintainers,

this doesn't only affect libvirt/KVM somewhat, but it also breaks LXC,
which also uses its own cgropus. lxc-attach will stop working once
systemctl daemon-reload has been issued with a running LXC instance.
Since this breaks two unrelated pieces of software, I think the
severity 'serious' is justified.[1]

I've backported the commit that was used to fix this upstream and
attached it to this mail. The original commit was committed after the
Delegate= property was added to units, I left out that part (i.e. it
will only consider slice units). I've tested the patch and libvirt/KVM
and LXC now remain in their cgroups with systemctl daemon-reload (I've
tested both here).


(Side note: daemon-reload alone is not necessarily sufficient to
reproduce this issue, but if one starts a unit afterwards, it will
occur. Therefore, using systemctl daemon-reload + systemctl restart
exim4.service will consistently reproduce the issue on my systems.)



Christian

[1] I do feel a bit bad because I've already reported / upgraded the
severity of a couple of systemd bugs, but I do think that in every
case I can justify this being RC... Please don't consider this to be
criticism of your work, I just want to make sure that systemd in Jessie
is in a very good shape.
Description: core: don't migrate PIDs for units that may contain subcgroups, do 
this only for leaf units
 Otherwise a slice or delegation unit might move PIDs around ignoring
 the fact that it is attached to a subcgroup.
 .
 This backport of the original commit does not include the part about
 delegate units that was intrdocued into the systemd source code at
 commit a931ad47a8623163a29d898224d8a8c1177ffdaf, since that is  not
 part of systemd 215.
Author: Lennart Poettering <lenn...@poettering.net>
Origin: backport
Bug-Redhat: https://bugzilla.redhat.com/show_bug.cgi?id=1139223
Applied-Upstream: 0cd385d31814c8c1bc0c81d11ef321036b8b0921
Last-Update: 2015-03-15
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -594,10 +594,15 @@ static const char *migrate_callback(CGro
 
 static int unit_create_cgroups(Unit *u, CGroupControllerMask mask) {
         _cleanup_free_ char *path = NULL;
+        CGroupContext *c;
         int r;
 
         assert(u);
 
+        c = unit_get_cgroup_context(u);
+        if (!c)
+                return 0;
+
         path = unit_default_cgroup_path(u);
         if (!path)
                 return log_oom();
@@ -623,10 +628,14 @@ static int unit_create_cgroups(Unit *u,
         u->cgroup_realized = true;
         u->cgroup_realized_mask = mask;
 
-        /* Then, possibly move things over */
-        r = cg_migrate_everywhere(u->manager->cgroup_supported, 
u->cgroup_path, u->cgroup_path, migrate_callback, u);
-        if (r < 0)
-                log_warning("Failed to migrate cgroup from to %s: %s", 
u->cgroup_path, strerror(-r));
+        /* Then, possibly move things over, but not if
+         * subgroups may contain processes, which is the case
+         * for slice units. */
+        if (u->type != UNIT_SLICE) {
+                r = cg_migrate_everywhere(u->manager->cgroup_supported, 
u->cgroup_path, u->cgroup_path, migrate_callback, u);
+                if (r < 0)
+                        log_warning("Failed to migrate cgroup from to %s: %s", 
u->cgroup_path, strerror(-r));
+        }
 
         return 0;
 }
_______________________________________________
Pkg-systemd-maintainers mailing list
Pkg-systemd-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-systemd-maintainers

Reply via email to