summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-09-05 15:32:57 -0700
committerLennart Poettering <lennart@poettering.net>2012-09-05 15:32:57 -0700
commit57371e5829a61e5ee6c9f98404dfc729d6c62608 (patch)
tree5ad0f67db34b8571d575664b3e1072a5910ff065
parent3eabccc46c003d129a847ba423a6d0ba778e4930 (diff)
shutdown: remove explicit sync() invocations
The kernel implicitly does sync() anyway, hence there is no need to do that in userspace explicitly. This makes the "-n" switch to halt(8) a noop.
-rw-r--r--man/halt.xml9
-rw-r--r--src/core/shutdown.c2
-rw-r--r--src/systemctl/systemctl.c11
3 files changed, 1 insertions, 21 deletions
diff --git a/man/halt.xml b/man/halt.xml
index 7ba85ed88d..ed1c52c586 100644
--- a/man/halt.xml
+++ b/man/halt.xml
@@ -136,15 +136,6 @@
</varlistentry>
<varlistentry>
- <term><option>-n</option></term>
- <term><option>--no-sync</option></term>
-
- <listitem><para>Don't sync hard disks/storage media before
- halt, power-off,
- reboot.</para></listitem>
- </varlistentry>
-
- <varlistentry>
<term><option>--no-wall</option></term>
<listitem><para>Don't send wall
diff --git a/src/core/shutdown.c b/src/core/shutdown.c
index c3a4c390be..558111b3d4 100644
--- a/src/core/shutdown.c
+++ b/src/core/shutdown.c
@@ -279,8 +279,6 @@ int main(int argc, char *argv[]) {
}
}
- sync();
-
if (cmd == LINUX_REBOOT_CMD_KEXEC) {
/* We cheat and exec kexec to avoid doing all its work */
pid_t pid = fork();
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 871a04bc1b..14f8a129d5 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -74,7 +74,6 @@ static bool arg_no_block = false;
static bool arg_no_legend = false;
static bool arg_no_pager = false;
static bool arg_no_wtmp = false;
-static bool arg_no_sync = false;
static bool arg_no_wall = false;
static bool arg_no_reload = false;
static bool arg_dry = false;
@@ -3949,7 +3948,6 @@ static int halt_help(void) {
" -f --force Force immediate halt/power-off/reboot\n"
" -w --wtmp-only Don't halt/power-off/reboot, just write wtmp record\n"
" -d --no-wtmp Don't write wtmp record\n"
- " -n --no-sync Don't sync before halt/power-off/reboot\n"
" --no-wall Don't send wall message before halt/power-off/reboot\n",
program_invocation_short_name,
arg_action == ACTION_REBOOT ? "Reboot" :
@@ -4271,7 +4269,6 @@ static int halt_parse_argv(int argc, char *argv[]) {
{ "force", no_argument, NULL, 'f' },
{ "wtmp-only", no_argument, NULL, 'w' },
{ "no-wtmp", no_argument, NULL, 'd' },
- { "no-sync", no_argument, NULL, 'n' },
{ "no-wall", no_argument, NULL, ARG_NO_WALL },
{ NULL, 0, NULL, 0 }
};
@@ -4317,16 +4314,13 @@ static int halt_parse_argv(int argc, char *argv[]) {
arg_no_wtmp = true;
break;
- case 'n':
- arg_no_sync = true;
- break;
-
case ARG_NO_WALL:
arg_no_wall = true;
break;
case 'i':
case 'h':
+ case 'n':
/* Compatibility nops */
break;
@@ -5168,9 +5162,6 @@ static int halt_main(DBusConnection *bus) {
}
}
- if (!arg_no_sync)
- sync();
-
if (arg_dry)
return 0;