SHA256
1
0
forked from pool/systemd
systemd/0001-add-hdflush-for-reboot-or-hddown-for-poweroff.patch
2015-03-27 08:39:40 +00:00

85 lines
3.0 KiB
Diff

---
src/core/shutdown.c | 4 ++++
src/systemctl/systemctl.c | 18 ++++++++++++------
2 files changed, 16 insertions(+), 6 deletions(-)
Index: systemd-218/src/core/shutdown.c
===================================================================
--- systemd-218.orig/src/core/shutdown.c
+++ systemd-218/src/core/shutdown.c
@@ -400,6 +400,10 @@ int main(int argc, char *argv[]) {
}
reboot(cmd);
+
+ if (cmd == (int)RB_POWER_OFF)
+ reboot(RB_HALT_SYSTEM);
+
if (errno == EPERM && in_container) {
/* If we are in a container, and we lacked
* CAP_SYS_BOOT just exit, this will kill our
Index: systemd-218/src/systemctl/systemctl.c
===================================================================
--- systemd-218.orig/src/systemctl/systemctl.c
+++ systemd-218/src/systemctl/systemctl.c
@@ -94,6 +94,7 @@ static bool arg_no_pager = false;
static bool arg_no_wtmp = false;
static bool arg_no_wall = false;
static bool arg_no_reload = false;
+static bool arg_no_sync = false;
static bool arg_show_types = false;
static bool arg_ignore_inhibitors = false;
static bool arg_dry = false;
@@ -6813,6 +6814,7 @@ static int halt_parse_argv(int argc, cha
{ "reboot", no_argument, NULL, ARG_REBOOT },
{ "force", no_argument, NULL, 'f' },
{ "wtmp-only", no_argument, NULL, 'w' },
+ { "no-sync", no_argument, NULL, 'n' },
{ "no-wtmp", no_argument, NULL, 'd' },
{ "no-wall", no_argument, NULL, ARG_NO_WALL },
{}
@@ -6865,10 +6867,13 @@ static int halt_parse_argv(int argc, cha
case 'i':
case 'h':
- case 'n':
/* Compatibility nops */
break;
+ case 'n':
+ arg_no_sync = true;
+ break;
+
case '?':
return -EINVAL;
@@ -7511,7 +7516,8 @@ static int halt_now(enum action a) {
/* The kernel will automaticall flush ATA disks and suchlike
* on reboot(), but the file systems need to be synce'd
* explicitly in advance. */
- sync();
+ if (!arg_no_sync)
+ sync();
/* Make sure C-A-D is handled by the kernel from this point
* on... */
@@ -7519,14 +7525,14 @@ static int halt_now(enum action a) {
switch (a) {
- case ACTION_HALT:
- log_info("Halting.");
- reboot(RB_HALT_SYSTEM);
- return -errno;
case ACTION_POWEROFF:
log_info("Powering off.");
reboot(RB_POWER_OFF);
+ /* fall-through */
+ case ACTION_HALT:
+ log_info("Halting.");
+ reboot(RB_HALT_SYSTEM);
return -errno;
case ACTION_REBOOT: {