mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-19 13:31:28 +02:00
Merge pull request #609 from marineam/systemd
maint(sys-apps/systemd): Sync patches with upstream
This commit is contained in:
commit
bcf1ed50d5
@ -1,25 +0,0 @@
|
|||||||
From foo@baz Wed Mar 12 23:13:38 +0000
|
|
||||||
Date: Wed, 12 Mar 2014 23:13:38 +0000
|
|
||||||
From: Greg Kroah-Hartman <greg@kroah.com>
|
|
||||||
Subject: Handle empty /etc/os-release
|
|
||||||
|
|
||||||
systemd uses /etc/os-release as a "flag" file to see if the filesystem
|
|
||||||
really is an operating system image or not. As we "know" we will always
|
|
||||||
boot a valid filesystem, and we want to be able to handle an empty /etc
|
|
||||||
directory (tmpfiles will recreate it, it is a symlink) just comment out
|
|
||||||
the check and move on with our lives.
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
|
|
||||||
index 30f28b6e2cd6..a270834f47d8 100644
|
|
||||||
--- a/src/core/dbus-manager.c
|
|
||||||
+++ b/src/core/dbus-manager.c
|
|
||||||
@@ -1133,7 +1133,7 @@ static int method_switch_root(sd_bus *bus, sd_bus_message *message, void *userda
|
|
||||||
|
|
||||||
/* Safety check */
|
|
||||||
if (isempty(init)) {
|
|
||||||
- if (! path_is_os_tree(root))
|
|
||||||
+ if (0)
|
|
||||||
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Specified switch root path %s does not seem to be an OS tree. /etc/os-release is missing.", root);
|
|
||||||
} else {
|
|
||||||
_cleanup_free_ char *p = NULL;
|
|
@ -0,0 +1,35 @@
|
|||||||
|
From ff790a30ceae4e64249544f9719f78c385308f67 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Brandon Philips <brandon@ifup.co>
|
||||||
|
Date: Fri, 25 Apr 2014 09:31:59 -0600
|
||||||
|
Subject: [PATCH 2/4] job: add waiting jobs to run queue in unit_coldplug
|
||||||
|
|
||||||
|
When we have job installed and added to run queue for service which is
|
||||||
|
still in dead state and systemd initiates reload then after reload we
|
||||||
|
never add deserialized job to the run queue again. This is caused by
|
||||||
|
check in service_coldplug() where we check if deserialized state is
|
||||||
|
something else than dead state, which is not the case thus we never call
|
||||||
|
service_set_state() and finally unit_notify() where we would have added
|
||||||
|
job to the run queue.
|
||||||
|
|
||||||
|
Thanks to Michal Sekletar <msekleta@redhat.com> for the original patch.
|
||||||
|
---
|
||||||
|
src/core/job.c | 3 +++
|
||||||
|
1 file changed, 3 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/core/job.c b/src/core/job.c
|
||||||
|
index 35a9de6..835cfe1 100644
|
||||||
|
--- a/src/core/job.c
|
||||||
|
+++ b/src/core/job.c
|
||||||
|
@@ -1066,6 +1066,9 @@ int job_coldplug(Job *j) {
|
||||||
|
if (j->timer_event_source)
|
||||||
|
j->timer_event_source = sd_event_source_unref(j->timer_event_source);
|
||||||
|
|
||||||
|
+ if (j->state == JOB_WAITING)
|
||||||
|
+ job_add_to_run_queue(j);
|
||||||
|
+
|
||||||
|
r = sd_event_add_time(
|
||||||
|
j->manager->event,
|
||||||
|
&j->timer_event_source,
|
||||||
|
--
|
||||||
|
1.8.5.5
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
From 7b6a4f0380c0f95e0ce1beccddd82b6c4aecc8bc Mon Sep 17 00:00:00 2001
|
|
||||||
From: Michal Sekletar <msekleta@redhat.com>
|
|
||||||
Date: Tue, 1 Apr 2014 18:45:54 +0200
|
|
||||||
Subject: [PATCH] unit: add waiting jobs to run queue in unit_coldplug
|
|
||||||
|
|
||||||
When we have job installed and added to run queue for service which is still in
|
|
||||||
dead state and systemd initiates reload then after reload we never add
|
|
||||||
deserialized job to the run queue again. This is caused by check in
|
|
||||||
service_coldplug() where we check if deserialized state is something else
|
|
||||||
than dead state, which is not the case thus we never call service_set_state()
|
|
||||||
and finally unit_notify() where we would have added job to the run queue.
|
|
||||||
---
|
|
||||||
src/core/unit.c | 3 +++
|
|
||||||
1 file changed, 3 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/src/core/unit.c b/src/core/unit.c
|
|
||||||
index 153b79b..bb7893b 100644
|
|
||||||
--- a/src/core/unit.c
|
|
||||||
+++ b/src/core/unit.c
|
|
||||||
@@ -2558,6 +2558,9 @@ int unit_coldplug(Unit *u) {
|
|
||||||
r = job_coldplug(u->job);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
+
|
|
||||||
+ if (u->job->state == JOB_WAITING)
|
|
||||||
+ job_add_to_run_queue(u->job);
|
|
||||||
} else if (u->deserialized_job >= 0) {
|
|
||||||
/* legacy */
|
|
||||||
r = manager_add_job(u->manager, u->deserialized_job, u, JOB_IGNORE_REQUIREMENTS, false, NULL, NULL);
|
|
||||||
--
|
|
||||||
1.8.3.2
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
|||||||
From 5572e8cef02a1d769a94c5da4c407c0f472535f2 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Michael Marineau <michael.marineau@coreos.com>
|
|
||||||
Date: Tue, 6 May 2014 18:39:59 -0700
|
|
||||||
Subject: [PATCH] device: Add stub serialization methods to enable job
|
|
||||||
serialization.
|
|
||||||
|
|
||||||
If a unit type doesn't provide its own serialization methods then
|
|
||||||
none of the generic serialization will happen either. For devices this
|
|
||||||
means jobs used for waiting on device dependencies are dropped during
|
|
||||||
reloads, breaking dependency state that was relying on those jobs.
|
|
||||||
---
|
|
||||||
src/core/device.c | 22 ++++++++++++++++++++++
|
|
||||||
1 file changed, 22 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/src/core/device.c b/src/core/device.c
|
|
||||||
index 444286e..07c0860 100644
|
|
||||||
--- a/src/core/device.c
|
|
||||||
+++ b/src/core/device.c
|
|
||||||
@@ -130,6 +130,25 @@ static void device_dump(Unit *u, FILE *f, const char *prefix) {
|
|
||||||
prefix, strna(d->sysfs));
|
|
||||||
}
|
|
||||||
|
|
||||||
+static int device_serialize(Unit *u, FILE *f, FDSet *fds) {
|
|
||||||
+ assert(u);
|
|
||||||
+ assert(f);
|
|
||||||
+ assert(fds);
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int device_deserialize_item(Unit *u, const char *key, const char *value, FDSet *fds) {
|
|
||||||
+ assert(u);
|
|
||||||
+ assert(key);
|
|
||||||
+ assert(value);
|
|
||||||
+ assert(fds);
|
|
||||||
+
|
|
||||||
+ log_debug("Unknown serialization key '%s'", key);
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
_pure_ static UnitActiveState device_active_state(Unit *u) {
|
|
||||||
assert(u);
|
|
||||||
|
|
||||||
@@ -693,6 +712,9 @@ const UnitVTable device_vtable = {
|
|
||||||
|
|
||||||
.dump = device_dump,
|
|
||||||
|
|
||||||
+ .serialize = device_serialize,
|
|
||||||
+ .deserialize_item = device_deserialize_item,
|
|
||||||
+
|
|
||||||
.active_state = device_active_state,
|
|
||||||
.sub_state_to_string = device_sub_state_to_string,
|
|
||||||
|
|
||||||
--
|
|
||||||
1.8.5.5
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
|||||||
|
From 05728416aba07cf66e6933e65c5c076643a1d62b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michael Marineau <michael.marineau@coreos.com>
|
||||||
|
Date: Mon, 12 May 2014 09:26:16 +0200
|
||||||
|
Subject: [PATCH 3/4] job: always add waiting jobs to run queue during coldplug
|
||||||
|
|
||||||
|
commit 20a83d7bf was not equivalent to the original bug fix proposed by
|
||||||
|
Michal Sekletar <msekleta@redhat.com>. The committed version only added
|
||||||
|
the job to the run queue if the job had a timeout, which most jobs do
|
||||||
|
not have. Just re-ordering the code gets us the intended functionality
|
||||||
|
---
|
||||||
|
src/core/job.c | 6 +++---
|
||||||
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/core/job.c b/src/core/job.c
|
||||||
|
index 835cfe1..dc4f441 100644
|
||||||
|
--- a/src/core/job.c
|
||||||
|
+++ b/src/core/job.c
|
||||||
|
@@ -1060,15 +1060,15 @@ int job_coldplug(Job *j) {
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
+ if (j->state == JOB_WAITING)
|
||||||
|
+ job_add_to_run_queue(j);
|
||||||
|
+
|
||||||
|
if (j->begin_usec == 0 || j->unit->job_timeout == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (j->timer_event_source)
|
||||||
|
j->timer_event_source = sd_event_source_unref(j->timer_event_source);
|
||||||
|
|
||||||
|
- if (j->state == JOB_WAITING)
|
||||||
|
- job_add_to_run_queue(j);
|
||||||
|
-
|
||||||
|
r = sd_event_add_time(
|
||||||
|
j->manager->event,
|
||||||
|
&j->timer_event_source,
|
||||||
|
--
|
||||||
|
1.8.5.5
|
||||||
|
|
@ -0,0 +1,118 @@
|
|||||||
|
From fb7fe351e092bb591a6fc24c76fd4a8effec644d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Lennart Poettering <lennart@poettering.net>
|
||||||
|
Date: Fri, 16 May 2014 01:15:03 +0200
|
||||||
|
Subject: [PATCH 4/4] core: make sure to serialize jobs for all units
|
||||||
|
|
||||||
|
Previously we wouldn't serialize jobs for units that themselves have
|
||||||
|
nothing to serialize.
|
||||||
|
|
||||||
|
http://lists.freedesktop.org/archives/systemd-devel/2014-May/019051.html
|
||||||
|
---
|
||||||
|
src/core/manager.c | 3 ---
|
||||||
|
src/core/unit.c | 43 +++++++++++++++++++++----------------------
|
||||||
|
2 files changed, 21 insertions(+), 25 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/core/manager.c b/src/core/manager.c
|
||||||
|
index 224106c..0b91db3 100644
|
||||||
|
--- a/src/core/manager.c
|
||||||
|
+++ b/src/core/manager.c
|
||||||
|
@@ -2129,9 +2129,6 @@ int manager_serialize(Manager *m, FILE *f, FDSet *fds, bool switching_root) {
|
||||||
|
if (u->id != t)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
- if (!unit_can_serialize(u))
|
||||||
|
- continue;
|
||||||
|
-
|
||||||
|
/* Start marker */
|
||||||
|
fputs(u->id, f);
|
||||||
|
fputc('\n', f);
|
||||||
|
diff --git a/src/core/unit.c b/src/core/unit.c
|
||||||
|
index 153b79b..9147686 100644
|
||||||
|
--- a/src/core/unit.c
|
||||||
|
+++ b/src/core/unit.c
|
||||||
|
@@ -2287,25 +2287,25 @@ bool unit_can_serialize(Unit *u) {
|
||||||
|
}
|
||||||
|
|
||||||
|
int unit_serialize(Unit *u, FILE *f, FDSet *fds, bool serialize_jobs) {
|
||||||
|
- ExecRuntime *rt;
|
||||||
|
int r;
|
||||||
|
|
||||||
|
assert(u);
|
||||||
|
assert(f);
|
||||||
|
assert(fds);
|
||||||
|
|
||||||
|
- if (!unit_can_serialize(u))
|
||||||
|
- return 0;
|
||||||
|
-
|
||||||
|
- r = UNIT_VTABLE(u)->serialize(u, f, fds);
|
||||||
|
- if (r < 0)
|
||||||
|
- return r;
|
||||||
|
+ if (unit_can_serialize(u)) {
|
||||||
|
+ ExecRuntime *rt;
|
||||||
|
|
||||||
|
- rt = unit_get_exec_runtime(u);
|
||||||
|
- if (rt) {
|
||||||
|
- r = exec_runtime_serialize(rt, u, f, fds);
|
||||||
|
+ r = UNIT_VTABLE(u)->serialize(u, f, fds);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
+
|
||||||
|
+ rt = unit_get_exec_runtime(u);
|
||||||
|
+ if (rt) {
|
||||||
|
+ r = exec_runtime_serialize(rt, u, f, fds);
|
||||||
|
+ if (r < 0)
|
||||||
|
+ return r;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
dual_timestamp_serialize(f, "inactive-exit-timestamp", &u->inactive_exit_timestamp);
|
||||||
|
@@ -2367,17 +2367,14 @@ void unit_serialize_item(Unit *u, FILE *f, const char *key, const char *value) {
|
||||||
|
}
|
||||||
|
|
||||||
|
int unit_deserialize(Unit *u, FILE *f, FDSet *fds) {
|
||||||
|
- size_t offset;
|
||||||
|
ExecRuntime **rt = NULL;
|
||||||
|
+ size_t offset;
|
||||||
|
int r;
|
||||||
|
|
||||||
|
assert(u);
|
||||||
|
assert(f);
|
||||||
|
assert(fds);
|
||||||
|
|
||||||
|
- if (!unit_can_serialize(u))
|
||||||
|
- return 0;
|
||||||
|
-
|
||||||
|
offset = UNIT_VTABLE(u)->exec_runtime_offset;
|
||||||
|
if (offset > 0)
|
||||||
|
rt = (ExecRuntime**) ((uint8_t*) u + offset);
|
||||||
|
@@ -2494,17 +2491,19 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (rt) {
|
||||||
|
- r = exec_runtime_deserialize_item(rt, u, l, v, fds);
|
||||||
|
+ if (unit_can_serialize(u)) {
|
||||||
|
+ if (rt) {
|
||||||
|
+ r = exec_runtime_deserialize_item(rt, u, l, v, fds);
|
||||||
|
+ if (r < 0)
|
||||||
|
+ return r;
|
||||||
|
+ if (r > 0)
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ r = UNIT_VTABLE(u)->deserialize_item(u, l, v, fds);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
- if (r > 0)
|
||||||
|
- continue;
|
||||||
|
}
|
||||||
|
-
|
||||||
|
- r = UNIT_VTABLE(u)->deserialize_item(u, l, v, fds);
|
||||||
|
- if (r < 0)
|
||||||
|
- return r;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
1.8.5.5
|
||||||
|
|
@ -117,13 +117,11 @@ fi
|
|||||||
epatch "${FILESDIR}"/212-0001-sd-rtnl-fix-off-by-one.patch
|
epatch "${FILESDIR}"/212-0001-sd-rtnl-fix-off-by-one.patch
|
||||||
|
|
||||||
# fix stuck jobs after daemon-reload
|
# fix stuck jobs after daemon-reload
|
||||||
epatch "${FILESDIR}"/212-0002-unit-add-waiting-jobs-to-run-queue-in-unit_coldplug.patch
|
epatch "${FILESDIR}"/212-0002-job-add-waiting-jobs-to-run-queue-in-unit_coldplug.patch
|
||||||
|
epatch "${FILESDIR}"/212-0003-job-always-add-waiting-jobs-to-run-queue-during-cold.patch
|
||||||
|
|
||||||
# fix broken device dependencies after daemon-reload
|
# fix broken device dependencies after daemon-reload
|
||||||
epatch "${FILESDIR}"/212-0003-device-add-stub-serialization-methods-to-enable-job.patch
|
epatch "${FILESDIR}"/212-0004-core-make-sure-to-serialize-jobs-for-all-units.patch
|
||||||
|
|
||||||
# CoreOs specific hacks^Wfeatures
|
|
||||||
epatch "${FILESDIR}"/211-handle-empty-etc-os-release.patch
|
|
||||||
|
|
||||||
# patch to make journald work at first boot
|
# patch to make journald work at first boot
|
||||||
epatch "${FILESDIR}"/211-tmpfiles.patch
|
epatch "${FILESDIR}"/211-tmpfiles.patch
|
Loading…
x
Reference in New Issue
Block a user