|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
From cae7f26accc90031b04c6cedae10b54a6c854c87 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
From: Lennart Poettering <lennart@poettering.net>
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
Date: Fri, 31 Oct 2014 16:22:36 +0100
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
Subject: [PATCH] units: don't order journal flushing afte remote-fs.target
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
Instead, only depend on the actual file systems we need.
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
This should solve dep loops on setups where remote-fs.target is moved
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
into late boot.
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
(cherry picked from commit 919699ec301ea507edce4a619141ed22e789ac0d)
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
src/nspawn/nspawn.c | 38 ++++++++++++++--------------------
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
units/systemd-journal-flush.service.in | 3 ++-
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
2 files changed, 18 insertions(+), 23 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
index 7e96efd425..f332ade03e 100644
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
--- a/src/nspawn/nspawn.c
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+++ b/src/nspawn/nspawn.c
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
@@ -2911,8 +2911,8 @@ static int change_uid_gid(char **_home) {
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
* container argument.
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
* > 0 : The program executed in the container terminated with an
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
* error. The exit code of the program executed in the
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- * container is returned. No change is made to the container
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- * argument.
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ * container is returned. The container argument has been set
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ * to CONTAINER_TERMINATED.
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
* 0 : The container is being rebooted, has been shut down or exited
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
* successfully. The container argument has been set to either
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
* CONTAINER_TERMINATED or CONTAINER_REBOOTED.
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
@@ -2921,8 +2921,8 @@ static int change_uid_gid(char **_home) {
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
* error is indicated by a non-zero value.
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
*/
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
static int wait_for_container(pid_t pid, ContainerStatus *container) {
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- int r;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
siginfo_t status;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ int r;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
r = wait_for_terminate(pid, &status);
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
if (r < 0) {
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
@@ -2933,44 +2933,38 @@ static int wait_for_container(pid_t pid, ContainerStatus *container) {
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
switch (status.si_code) {
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
case CLD_EXITED:
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- r = status.si_status;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- if (r == 0) {
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- if (!arg_quiet)
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- log_debug("Container %s exited successfully.", arg_machine);
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ if (status.si_status == 0) {
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ log_full(arg_quiet ? LOG_DEBUG : LOG_INFO, "Container %s exited successfully.", arg_machine);
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- *container = CONTAINER_TERMINATED;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
} else
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- log_error("Container %s failed with error code %i.", arg_machine, status.si_status);
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ log_full(arg_quiet ? LOG_DEBUG : LOG_INFO, "Container %s failed with error code %i.", arg_machine, status.si_status);
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- break;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ *container = CONTAINER_TERMINATED;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ return status.si_status;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
case CLD_KILLED:
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
if (status.si_status == SIGINT) {
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- if (!arg_quiet)
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- log_info("Container %s has been shut down.", arg_machine);
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ log_full(arg_quiet ? LOG_DEBUG : LOG_INFO, "Container %s has been shut down.", arg_machine);
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
*container = CONTAINER_TERMINATED;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- r = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- break;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
} else if (status.si_status == SIGHUP) {
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- if (!arg_quiet)
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- log_info("Container %s is being rebooted.", arg_machine);
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ log_full(arg_quiet ? LOG_DEBUG : LOG_INFO, "Container %s is being rebooted.", arg_machine);
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
*container = CONTAINER_REBOOTED;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- r = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- break;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
/* CLD_KILLED fallthrough */
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
case CLD_DUMPED:
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
log_error("Container %s terminated by signal %s.", arg_machine, signal_to_string(status.si_status));
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- r = -EIO;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- break;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ return -EIO;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
default:
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
log_error("Container %s failed due to unknown reason.", arg_machine);
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- r = -EIO;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- break;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ return -EIO;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
return r;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
diff --git a/units/systemd-journal-flush.service.in b/units/systemd-journal-flush.service.in
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
index 699670bb4e..2612220e2e 100644
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
--- a/units/systemd-journal-flush.service.in
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+++ b/units/systemd-journal-flush.service.in
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
@@ -10,8 +10,9 @@ Description=Trigger Flushing of Journal to Persistent Storage
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
Documentation=man:systemd-journald.service(8) man:journald.conf(5)
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
DefaultDependencies=no
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
Requires=systemd-journald.service
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
-After=systemd-journald.service local-fs.target remote-fs.target
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+After=systemd-journald.service
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
Before=systemd-user-sessions.service systemd-tmpfiles-setup.service
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+RequiresMountsFor=/var/log/journal
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
[Service]
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
ExecStart=@rootbindir@/journalctl --flush
|