summaryrefslogtreecommitdiff
path: root/src/core/shutdown.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-11-16 01:30:29 +0100
committerLennart Poettering <lennart@poettering.net>2012-11-16 01:35:11 +0100
commit0049f05a8bb82c3e084bacc5945596761d706c55 (patch)
treed8aa0e8c916ec23c698a64e081a282fbe25a6502 /src/core/shutdown.c
parentf553b3b1074151200187df916427a1468186435e (diff)
shutdown: readd explicit sync() when shutting down
As it turns out reboot() doesn't actually imply a file system sync, but only a disk sync. Accordingly, readd explicit sync() invocations immediately before we invoke reboot(). This is much less dramatic than it might sounds as we umount all disks/read-only remount them anyway before going down.
Diffstat (limited to 'src/core/shutdown.c')
-rw-r--r--src/core/shutdown.c7
1 files changed, 7 insertions, 0 deletions
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) {