chiark / gitweb /
shutdown: readd explicit sync() when shutting down
[elogind.git] / src / core / shutdown.c
index cc8c57bd2d89e86f0ad0fa4a563d2221d3be06e7..b59aef174f14f1fd82e2069a0f406ebd43d46551 100644 (file)
@@ -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) {