forked from pool/systemd
Accepting request 338278 from home:fbui:branches:Base:System
OBS-URL: https://build.opensuse.org/request/show/338278 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=910
This commit is contained in:
parent
56f7a5c715
commit
1ac2792e9b
@ -0,0 +1,49 @@
|
||||
From 6a102f90a2ee50e43998d64819e8bd4ee241c22b Mon Sep 17 00:00:00 2001
|
||||
From: Franck Bui <fbui@suse.com>
|
||||
Date: Thu, 8 Oct 2015 19:06:06 +0200
|
||||
Subject: [PATCH 1/2] Make sure the mount units pulled by 'RequiresMountsFor='
|
||||
are loaded (if they exist)
|
||||
|
||||
We should make sure that mount units involved by 'RequiresMountsFor='
|
||||
directives are really loaded if not required by any others units so
|
||||
that Requires= dependencies on the mount units are applied and thus
|
||||
the mount unit dependencies are started.
|
||||
|
||||
(cherry picked from commit 9b3757e9c8c8d6e161481193c4ef60e425a9ae41)
|
||||
---
|
||||
src/core/unit.c | 14 ++++++++++++--
|
||||
1 file changed, 12 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/core/unit.c b/src/core/unit.c
|
||||
index dd5e801..dc7bc5a 100644
|
||||
--- a/src/core/unit.c
|
||||
+++ b/src/core/unit.c
|
||||
@@ -1141,13 +1141,23 @@ static int unit_add_mount_dependencies(Unit *u) {
|
||||
char prefix[strlen(*i) + 1];
|
||||
|
||||
PATH_FOREACH_PREFIX_MORE(prefix, *i) {
|
||||
+ _cleanup_free_ char *p = NULL;
|
||||
Unit *m;
|
||||
|
||||
- r = manager_get_unit_by_path(u->manager, prefix, ".mount", &m);
|
||||
+ r = unit_name_from_path(prefix, ".mount", &p);
|
||||
if (r < 0)
|
||||
return r;
|
||||
- if (r == 0)
|
||||
+
|
||||
+ m = manager_get_unit(u->manager, p);
|
||||
+ if (!m) {
|
||||
+ /* Make sure to load the mount unit if
|
||||
+ * it exists. If so the dependencies
|
||||
+ * on this unit will be added later
|
||||
+ * during the loading of the mount
|
||||
+ * unit. */
|
||||
+ (void) manager_load_unit_prepare(u->manager, p, NULL, NULL, &m);
|
||||
continue;
|
||||
+ }
|
||||
if (m == u)
|
||||
continue;
|
||||
|
||||
--
|
||||
2.6.0
|
||||
|
140
0002-units-enable-waiting-for-unit-termination-in-certain.patch
Normal file
140
0002-units-enable-waiting-for-unit-termination-in-certain.patch
Normal file
@ -0,0 +1,140 @@
|
||||
From d7f920bfcb0296fed214d4d3a21d64de09a68521 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Tue, 1 Sep 2015 17:25:59 +0200
|
||||
Subject: [PATCH 2/2] units: enable waiting for unit termination in certain
|
||||
cases
|
||||
|
||||
The legacy cgroup hierarchy does not support reliable empty
|
||||
notifications in containers and if there are left-over subgroups in a
|
||||
cgroup. This makes it hard to correctly wait for them running empty, and
|
||||
thus we previously disabled this logic entirely.
|
||||
|
||||
With this change we explicitly check for the container case, and whether
|
||||
the unit is a "delegation" unit (i.e. one where programs may create
|
||||
their own subgroups). If we are neither in a container, nor operating on
|
||||
a delegation unit cgroup empty notifications become reliable and thus we
|
||||
start waiting for the empty notifications again.
|
||||
|
||||
This doesn't really fix the general problem around cgroup notifications
|
||||
but reduces the effect around it.
|
||||
|
||||
(This also reorders #include lines by their focus, as suggsted in
|
||||
CODING_STYLE. We have to add "virt.h", so let's do that at the right
|
||||
place.)
|
||||
|
||||
Also see #317.
|
||||
|
||||
(cherry picked from commit e9db43d5910717a1084924c512bf85e2b8265375)
|
||||
---
|
||||
src/core/cgroup.c | 12 ++++++++++++
|
||||
src/core/cgroup.h | 2 ++
|
||||
src/core/unit.c | 40 +++++++++++++++++++++++-----------------
|
||||
3 files changed, 37 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
|
||||
index 6474e08..65af351 100644
|
||||
--- a/src/core/cgroup.c
|
||||
+++ b/src/core/cgroup.c
|
||||
@@ -1127,6 +1127,18 @@ int unit_reset_cpu_usage(Unit *u) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
+bool unit_cgroup_delegate(Unit *u) {
|
||||
+ CGroupContext *c;
|
||||
+
|
||||
+ assert(u);
|
||||
+
|
||||
+ c = unit_get_cgroup_context(u);
|
||||
+ if (!c)
|
||||
+ return false;
|
||||
+
|
||||
+ return c->delegate;
|
||||
+}
|
||||
+
|
||||
static const char* const cgroup_device_policy_table[_CGROUP_DEVICE_POLICY_MAX] = {
|
||||
[CGROUP_AUTO] = "auto",
|
||||
[CGROUP_CLOSED] = "closed",
|
||||
diff --git a/src/core/cgroup.h b/src/core/cgroup.h
|
||||
index 869ddae..7b38d21 100644
|
||||
--- a/src/core/cgroup.h
|
||||
+++ b/src/core/cgroup.h
|
||||
@@ -130,5 +130,7 @@ int unit_get_memory_current(Unit *u, uint64_t *ret);
|
||||
int unit_get_cpu_usage(Unit *u, nsec_t *ret);
|
||||
int unit_reset_cpu_usage(Unit *u);
|
||||
|
||||
+bool unit_cgroup_delegate(Unit *u);
|
||||
+
|
||||
const char* cgroup_device_policy_to_string(CGroupDevicePolicy i) _const_;
|
||||
CGroupDevicePolicy cgroup_device_policy_from_string(const char *s) _pure_;
|
||||
diff --git a/src/core/unit.c b/src/core/unit.c
|
||||
index dc7bc5a..275f567 100644
|
||||
--- a/src/core/unit.c
|
||||
+++ b/src/core/unit.c
|
||||
@@ -28,26 +28,28 @@
|
||||
#include "sd-id128.h"
|
||||
#include "sd-messages.h"
|
||||
#include "set.h"
|
||||
-#include "unit.h"
|
||||
#include "macro.h"
|
||||
#include "strv.h"
|
||||
#include "path-util.h"
|
||||
-#include "load-fragment.h"
|
||||
-#include "load-dropin.h"
|
||||
#include "log.h"
|
||||
-#include "unit-name.h"
|
||||
-#include "dbus-unit.h"
|
||||
-#include "special.h"
|
||||
#include "cgroup-util.h"
|
||||
#include "missing.h"
|
||||
#include "mkdir.h"
|
||||
#include "fileio-label.h"
|
||||
+#include "formats-util.h"
|
||||
+#include "process-util.h"
|
||||
+#include "virt.h"
|
||||
#include "bus-common-errors.h"
|
||||
+#include "bus-util.h"
|
||||
+#include "dropin.h"
|
||||
+#include "unit-name.h"
|
||||
+#include "special.h"
|
||||
+#include "unit.h"
|
||||
+#include "load-fragment.h"
|
||||
+#include "load-dropin.h"
|
||||
#include "dbus.h"
|
||||
+#include "dbus-unit.h"
|
||||
#include "execute.h"
|
||||
-#include "dropin.h"
|
||||
-#include "formats-util.h"
|
||||
-#include "process-util.h"
|
||||
|
||||
const UnitVTable * const unit_vtable[_UNIT_TYPE_MAX] = {
|
||||
[UNIT_SERVICE] = &service_vtable,
|
||||
@@ -3535,14 +3537,18 @@ int unit_kill_context(
|
||||
} else if (r > 0) {
|
||||
|
||||
/* FIXME: For now, we will not wait for the
|
||||
- * cgroup members to die, simply because
|
||||
- * cgroup notification is unreliable. It
|
||||
- * doesn't work at all in containers, and
|
||||
- * outside of containers it can be confused
|
||||
- * easily by leaving directories in the
|
||||
- * cgroup. */
|
||||
-
|
||||
- /* wait_for_exit = true; */
|
||||
+ * cgroup members to die if we are running in
|
||||
+ * a container or if this is a delegation
|
||||
+ * unit, simply because cgroup notification is
|
||||
+ * unreliable in these cases. It doesn't work
|
||||
+ * at all in containers, and outside of
|
||||
+ * containers it can be confused easily by
|
||||
+ * left-over directories in the cgroup --
|
||||
+ * which however should not exist in
|
||||
+ * non-delegated units. */
|
||||
+
|
||||
+ if (detect_container(NULL) == 0 && !unit_cgroup_delegate(u))
|
||||
+ wait_for_exit = true;
|
||||
|
||||
if (c->send_sighup && k != KILL_KILL) {
|
||||
set_free(pid_set);
|
||||
--
|
||||
2.6.0
|
||||
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Oct 12 11:34:13 UTC 2015 - fbui@suse.com
|
||||
|
||||
- Add 2 upstream patches to fix boo#949574 and bsc#932284
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Oct 9 18:03:02 UTC 2015 - fbui@suse.com
|
||||
|
||||
|
@ -182,6 +182,10 @@ Patch38: rules-add-lid-switch-of-ARM-based-Chromebook-as-a-power-sw.patch
|
||||
Patch84: make-emergency.service-conflict-with-syslog.socket.patch
|
||||
# PATCH-FIX-SUSE 0001-add-hdflush-for-reboot-or-hddown-for-poweroff.patch
|
||||
Patch86: 0001-add-hdflush-for-reboot-or-hddown-for-poweroff.patch
|
||||
# PATCH-FIX-UPSTREAM (boo#949574)
|
||||
Patch87: 0001-Make-sure-the-mount-units-pulled-by-RequiresMountsFo.patch
|
||||
# PATCH-FIX-UPSTREAM (bsc#932284)
|
||||
Patch88: 0002-units-enable-waiting-for-unit-termination-in-certain.patch
|
||||
# PATCH-FIX-SUSE 0001-On_s390_con3270_disable_ANSI_colour_esc.patch
|
||||
Patch90: 0001-On_s390_con3270_disable_ANSI_colour_esc.patch
|
||||
# PATCH-FIX-SUSE plymouth-quit-and-wait-for-emergency-service.patch -- Make sure that no plymouthd is locking the tty
|
||||
@ -556,6 +560,8 @@ cp %{SOURCE7} m4/
|
||||
%patch42 -p1
|
||||
%patch84 -p1
|
||||
%patch86 -p1
|
||||
%patch87 -p1
|
||||
%patch88 -p1
|
||||
%patch90 -p1
|
||||
%patch91 -p1
|
||||
%patch120 -p1
|
||||
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Oct 12 11:34:13 UTC 2015 - fbui@suse.com
|
||||
|
||||
- Add 2 upstream patches to fix boo#949574 and bsc#932284
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Oct 9 18:03:02 UTC 2015 - fbui@suse.com
|
||||
|
||||
|
@ -177,6 +177,10 @@ Patch38: rules-add-lid-switch-of-ARM-based-Chromebook-as-a-power-sw.patch
|
||||
Patch84: make-emergency.service-conflict-with-syslog.socket.patch
|
||||
# PATCH-FIX-SUSE 0001-add-hdflush-for-reboot-or-hddown-for-poweroff.patch
|
||||
Patch86: 0001-add-hdflush-for-reboot-or-hddown-for-poweroff.patch
|
||||
# PATCH-FIX-UPSTREAM (boo#949574)
|
||||
Patch87: 0001-Make-sure-the-mount-units-pulled-by-RequiresMountsFo.patch
|
||||
# PATCH-FIX-UPSTREAM (bsc#932284)
|
||||
Patch88: 0002-units-enable-waiting-for-unit-termination-in-certain.patch
|
||||
# PATCH-FIX-SUSE 0001-On_s390_con3270_disable_ANSI_colour_esc.patch
|
||||
Patch90: 0001-On_s390_con3270_disable_ANSI_colour_esc.patch
|
||||
# PATCH-FIX-SUSE plymouth-quit-and-wait-for-emergency-service.patch -- Make sure that no plymouthd is locking the tty
|
||||
@ -551,6 +555,8 @@ cp %{SOURCE7} m4/
|
||||
%patch42 -p1
|
||||
%patch84 -p1
|
||||
%patch86 -p1
|
||||
%patch87 -p1
|
||||
%patch88 -p1
|
||||
%patch90 -p1
|
||||
%patch91 -p1
|
||||
%patch120 -p1
|
||||
|
Loading…
Reference in New Issue
Block a user