mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 17:51:22 +03:00
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.
This commit is contained in:
parent
f553b3b107
commit
0049f05a8b
@ -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;
|
||||
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user