1
0
mirror of https://github.com/systemd/systemd synced 2026-04-18 04:55:04 +02:00

Compare commits

..

7 Commits

Author SHA1 Message Date
Lennart Poettering
05aca54468
Merge pull request #22378 from bluca/on_fail_follow_ups
Follow-ups for #20833
2022-02-04 16:29:09 +01:00
Lennart Poettering
3474ee526a
Merge pull request #22375 from michaelolbrich/watchdog
fix watchdog handling during reboot
2022-02-04 16:28:41 +01:00
Ruben Kerkhof
331f44c149 systemd.netdev(5): fix acronym for DOVE extensions 2022-02-05 00:10:20 +09:00
Michael Olbrich
119d5126d1 shutdown: don't stop the watchdog
This basically reverts #22079.

Stopping the watchdog is wrong. The reboot watchdog is supposed to cover
the whole time from the point when systemd start systemd-reboot until the
hardware resets.
Otherwise the system may hang in the final shutdown phase.

Add a comment, why keeping the watchdog running is correct here.
2022-02-04 12:26:58 +01:00
Michael Olbrich
f4b1a6b641 watchdog: fix watchdog_set_device() when the default watchdog device is used
If watchdog_set_device() is not called before open_watchdog() then
'watchdog_device' remains 'NULL' while the device is open.

As a result, the "same device" check in watchdog_set_device() does not work
correctly: If no device is specified (e.g. from watchdog_free_device())
then the current fd is not closed.

Fix this by setting 'watchdog_device' to the correct device during
open_watchdog()
2022-02-04 12:26:58 +01:00
Luca Boccassi
dde009a879 core: simply freeing list in job_free()
Follow-up for cdebedb4d40277aad62a7734ba920b4033228197
2022-02-02 16:33:25 +00:00
Luca Boccassi
b7b4252443 core: use strextend instead of strextendf when possible
Follow-up for cdebedb4d40277aad62a7734ba920b4033228197
2022-02-02 16:33:25 +00:00
5 changed files with 24 additions and 33 deletions

View File

@ -629,7 +629,7 @@
endpoint answers ARP requests from the local bridge on behalf
of remote Distributed Overlay Virtual Ethernet
<ulink url="https://en.wikipedia.org/wiki/Distributed_Overlay_Virtual_Ethernet">
(DVOE)</ulink> clients. Defaults to false.</para>
(DOVE)</ulink> clients. Defaults to false.</para>
</listitem>
</varlistentry>
<varlistentry>

View File

@ -99,12 +99,8 @@ Job* job_free(Job *j) {
assert(!j->subject_list);
assert(!j->object_list);
do {
Unit *tu = NULL;
LIST_FOREACH(triggered_by, tu, j->triggered_by)
LIST_REMOVE(triggered_by, j->triggered_by, tu);
} while (!LIST_IS_EMPTY(j->triggered_by));
while (!LIST_IS_EMPTY(j->triggered_by))
LIST_POP(triggered_by, j->triggered_by);
job_unlink(j);

View File

@ -1482,36 +1482,27 @@ static int service_create_monitor_md_env(Job *j, char **ret) {
if (!env_source)
continue;
if (first) {
/* Add the environment variable name first. */
r = strextendf(&var, "MONITOR_METADATA=");
if (r < 0)
return r;
/* Add the environment variable name first. */
if (first && !strextend(&var, "MONITOR_METADATA="))
return -ENOMEM;
}
r = strextendf(&var, "%sSERVICE_RESULT=%s",
!first ? list_delim : "", service_result_to_string(env_source->result));
if (r < 0)
return r;
if (!strextend(&var, !first ? list_delim : "", "SERVICE_RESULT=", service_result_to_string(env_source->result)))
return -ENOMEM;
first = false;
if (env_source->main_exec_status.pid > 0 &&
dual_timestamp_is_set(&env_source->main_exec_status.exit_timestamp)) {
r = strextendf(&var, ",EXIT_CODE=%s",
sigchld_code_to_string(env_source->main_exec_status.code));
if (r < 0)
return r;
if (!strextend(&var, ",EXIT_CODE=", sigchld_code_to_string(env_source->main_exec_status.code)))
return -ENOMEM;
if (env_source->main_exec_status.code == CLD_EXITED)
if (env_source->main_exec_status.code == CLD_EXITED) {
r = strextendf(&var, ",EXIT_STATUS=%i",
env_source->main_exec_status.status);
else
r = strextendf(&var, ",EXIT_STATUS=%s",
signal_to_string(env_source->main_exec_status.status));
if (r < 0)
return r;
if (r < 0)
return r;
} else if (!strextend(&var, ",EXIT_STATUS=", signal_to_string(env_source->main_exec_status.status)))
return -ENOMEM;
}
if (!sd_id128_is_null(UNIT(env_source)->invocation_id)) {
@ -1521,9 +1512,8 @@ static int service_create_monitor_md_env(Job *j, char **ret) {
return r;
}
r = strextendf(&var, ",UNIT=%s", UNIT(env_source)->id);
if (r < 0)
return r;
if (!strextend(&var, ",UNIT=", UNIT(env_source)->id))
return -ENOMEM;
}
*ret = TAKE_PTR(var);

View File

@ -133,6 +133,10 @@ static int open_watchdog(void) {
fn = !watchdog_device || path_equal(watchdog_device, "/dev/watchdog") ?
"/dev/watchdog0" : watchdog_device;
r = free_and_strdup(&watchdog_device, fn);
if (r < 0)
return log_oom_debug();
watchdog_fd = open(fn, O_WRONLY|O_CLOEXEC);
if (watchdog_fd < 0)
return log_debug_errno(errno, "Failed to open watchdog device %s, ignoring: %m", fn);

View File

@ -531,8 +531,9 @@ int main(int argc, char *argv[]) {
need_md_detach ? " MD devices," : "");
}
/* We're done with the watchdog. */
watchdog_close(true);
/* We're done with the watchdog. Note that the watchdog is explicitly not
* stopped here. It remains active to guard against any issues during the
* rest of the shutdown sequence. */
watchdog_free_device();
arguments[0] = NULL;