Bug#777164: systemd: libvirt cgroups start to disappear from machine.slice after systemctl daemon-reload

2015-03-16 Thread Michael Biebl
Am 15.03.2015 um 12:33 schrieb Christian Seiler:
 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.)


It would be great, if Mateusz can confirm that this patch [1] does
indeed fix his issue.
Mateusz, if you are not versed in compiling packages yourself and you
would prefer if we provided you with a test package, please let us know.


 [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.

Don't worry, Christian. Your efforts are very much appreciated!



[1]
https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=19;filename=don-t-migrate-PIDs-for-units-that-may-contain-subcgroups.patch;att=1;bug=777164
-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?



signature.asc
Description: OpenPGP digital signature
___
Pkg-systemd-maintainers mailing list
Pkg-systemd-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-systemd-maintainers

Bug#777164: systemd: libvirt cgroups start to disappear from machine.slice after systemctl daemon-reload

2015-03-16 Thread Christian Seiler

Am 2015-03-16 13:51, schrieb Michael Biebl:

It would be great, if Mateusz can confirm that this patch [1] does
indeed fix his issue.
Mateusz, if you are not versed in compiling packages yourself and you
would prefer if we provided you with a test package, please let us 
know.


I can also provide binary packages of 215-12 + just this patch for
amd64 and i386, in case building from source isn't an option.


Don't worry, Christian. Your efforts are very much appreciated!


Thanks!


[1]

https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=19;filename=don-t-migrate-PIDs-for-units-that-may-contain-subcgroups.patch;att=1;bug=777164


I just noticed that the description of the patch has a typo, before
committing that should probably be fixed. (s/intrdocued/introduced/)

Christian

___
Pkg-systemd-maintainers mailing list
Pkg-systemd-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-systemd-maintainers


Bug#777164: systemd: libvirt cgroups start to disappear from machine.slice after systemctl daemon-reload

2015-03-15 Thread Christian Seiler

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

Bug#777164: systemd: libvirt cgroups start to disappear from machine.slice after systemctl daemon-reload

2015-02-05 Thread Michael Biebl
contol: forwarded -1 https://bugzilla.redhat.com/show_bug.cgi?id=1139223

Am 5. Februar 2015 20:06:56 MEZ, schrieb Mateusz Nalewajski 
nalewaj...@gmail.com:
Package: systemd
Version: 215-10
Severity: important

Dear Maintainer,

I use libvirt with KVM on Debian Jessie for virtualizing my lab
environment. However when I tried once to connect an USB host device to
the virtual machine, libvirt complained about missing cgroup. When I
went through the /sys/fs/cgroup I found that cgroups of some running
virtual machines are not in machine.slice anymore.

Here is a link to a similar bug on Red Hat Bugzilla
https://bugzilla.redhat.com/show_bug.cgi?id=1139223

___
Pkg-systemd-maintainers mailing list
Pkg-systemd-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-systemd-maintainers