summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/service.c1
-rw-r--r--src/core/shutdown.c7
2 files changed, 8 insertions, 0 deletions
diff --git a/src/core/service.c b/src/core/service.c
index cf08485374..df72abab01 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -2485,6 +2485,7 @@ static int service_start_limit_test(Service *s) {
case SERVICE_START_LIMIT_REBOOT_IMMEDIATE:
log_warning("%s start request repeated too quickly, rebooting immediately.", UNIT(s)->id);
+ sync();
reboot(RB_AUTOBOOT);
break;
diff --git a/src/core/shutdown.c b/src/core/shutdown.c
index cc8c57bd2d..b59aef174f 100644
--- a/src/core/shutdown.c
+++ b/src/core/shutdown.c
@@ -273,6 +273,13 @@ int main(int argc, char *argv[]) {
}
}
+ /* The kernel will automaticall flush ATA disks and suchlike
+ * on reboot(), but the file systems need to be synce'd
+ * explicitly in advance. So let's do this here, but not
+ * needlessly slow down containers. */
+ if (!in_container)
+ sync();
+
if (cmd == LINUX_REBOOT_CMD_KEXEC) {
if (!in_container) {