summaryrefslogtreecommitdiffstats
path: root/src/core/manager-serialize.c
diff options
context:
space:
mode:
authorLuca Boccassi <bluca@debian.org>2024-03-26 23:28:58 +0100
committerLuca Boccassi <bluca@debian.org>2024-03-27 02:25:49 +0100
commit375d091f71fdc7651aaef1907866409416779325 (patch)
tree02e78b41fe6f3f4bc929eac87ec5c1046c84e8fe /src/core/manager-serialize.c
parentMerge pull request #31789 from jsitnicki/socket-pass-fds-to-exec (diff)
downloadsystemd-375d091f71fdc7651aaef1907866409416779325.tar.xz
systemd-375d091f71fdc7651aaef1907866409416779325.zip
core: do not serialize timestamps that are re-measured on soft-reboot
Otherwise the de-serialization overwrites the timestamps taken after soft-reboot (e.g.: userspace start/finish) and sd-analyze shows bogus data
Diffstat (limited to 'src/core/manager-serialize.c')
-rw-r--r--src/core/manager-serialize.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/manager-serialize.c b/src/core/manager-serialize.c
index 0d91faee6f..3af6723e5f 100644
--- a/src/core/manager-serialize.c
+++ b/src/core/manager-serialize.c
@@ -23,11 +23,12 @@ int manager_open_serialization(Manager *m, FILE **ret_f) {
return open_serialization_file("systemd-state", ret_f);
}
-static bool manager_timestamp_shall_serialize(ManagerTimestamp t) {
- if (!in_initrd())
+static bool manager_timestamp_shall_serialize(ManagerObjective o, ManagerTimestamp t) {
+ if (!in_initrd() && o != MANAGER_SOFT_REBOOT)
return true;
- /* The following timestamps only apply to the host system, hence only serialize them there */
+ /* The following timestamps only apply to the host system (or first boot in case of soft-reboot),
+ * hence only serialize them there. */
return !IN_SET(t,
MANAGER_TIMESTAMP_USERSPACE, MANAGER_TIMESTAMP_FINISH,
MANAGER_TIMESTAMP_SECURITY_START, MANAGER_TIMESTAMP_SECURITY_FINISH,
@@ -111,7 +112,7 @@ int manager_serialize(
for (ManagerTimestamp q = 0; q < _MANAGER_TIMESTAMP_MAX; q++) {
_cleanup_free_ char *joined = NULL;
- if (!manager_timestamp_shall_serialize(q))
+ if (!manager_timestamp_shall_serialize(m->objective, q))
continue;
joined = strjoin(manager_timestamp_to_string(q), "-timestamp");