summaryrefslogtreecommitdiff
path: root/src/grp-system/systemd-shutdown
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-09-14 18:33:57 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-09-14 18:33:57 -0400
commit3c72c8d3ee67388336aca58c5afa3fb93a9c24c0 (patch)
treed072df7fee0f5906fad88c08398b2fe887cbc064 /src/grp-system/systemd-shutdown
parente51613a3291342c6006edda8783755fb8994fd75 (diff)
parent6ba6ca19507add38549e07058c57489a8cd98cd1 (diff)
Merge branch 'notsystemd/postmove' into notsystemd/master
# Conflicts: # src/grp-journal/systemd-journald/Makefile # src/grp-login/systemd-logind/Makefile # src/grp-machine/grp-import/systemd-export/Makefile # src/grp-machine/grp-import/systemd-import/Makefile # src/grp-machine/grp-import/systemd-pull/Makefile # src/grp-machine/systemd-machined/Makefile # src/grp-network/libnetworkd-core/Makefile # src/grp-resolve/libbasic-dns/Makefile # src/grp-resolve/systemd-resolved/Makefile # src/grp-utils/systemd-path/Makefile # src/libshared/src/Makefile # src/libsystemd-network/include/systemd-network/sd-ndisc.h # src/libsystemd/Makefile # src/libsystemd/src/test.mk # src/libudev/Makefile # src/systemd-dbus1-generator/Makefile # src/systemd-nspawn/nspawn.c Signed-off-by: Luke Shumaker <lukeshu@sbcglobal.net>
Diffstat (limited to 'src/grp-system/systemd-shutdown')
-rw-r--r--src/grp-system/systemd-shutdown/Makefile2
-rw-r--r--src/grp-system/systemd-shutdown/shutdown.c20
-rw-r--r--src/grp-system/systemd-shutdown/systemd-shutdown.xml1
3 files changed, 14 insertions, 9 deletions
diff --git a/src/grp-system/systemd-shutdown/Makefile b/src/grp-system/systemd-shutdown/Makefile
index 257a057823..c56f0f9adc 100644
--- a/src/grp-system/systemd-shutdown/Makefile
+++ b/src/grp-system/systemd-shutdown/Makefile
@@ -34,7 +34,7 @@ systemd_shutdown_SOURCES = \
src/core/killall.c
systemd_shutdown_LDADD = \
- libshared.la
+ libsystemd-shared.la
sd.CPPFLAGS += -DSYSTEM_SHUTDOWN_PATH=\"$(systemshutdowndir)\"
sd.CPPFLAGS += -DKEXEC=\"$(KEXEC)\"
diff --git a/src/grp-system/systemd-shutdown/shutdown.c b/src/grp-system/systemd-shutdown/shutdown.c
index bf74b5ec99..093b6eea87 100644
--- a/src/grp-system/systemd-shutdown/shutdown.c
+++ b/src/grp-system/systemd-shutdown/shutdown.c
@@ -159,7 +159,6 @@ static int switch_root_initramfs(void) {
return switch_root("/run/initramfs", "/oldroot", false, MS_BIND);
}
-
int main(int argc, char *argv[]) {
bool need_umount, need_swapoff, need_loop_detach, need_dm_detach;
bool in_container, use_watchdog = false;
@@ -205,20 +204,25 @@ int main(int argc, char *argv[]) {
}
(void) cg_get_root_path(&cgroup);
+ in_container = detect_container() > 0;
use_watchdog = !!getenv("WATCHDOG_USEC");
- /* lock us into memory */
+ /* Lock us into memory */
mlockall(MCL_CURRENT|MCL_FUTURE);
+ /* Synchronize everything that is not written to disk yet at this point already. This is a good idea so that
+ * slow IO is processed here already and the final process killing spree is not impacted by processes
+ * desperately trying to sync IO to disk within their timeout. */
+ if (!in_container)
+ sync();
+
log_info("Sending SIGTERM to remaining processes...");
broadcast_signal(SIGTERM, true, true);
log_info("Sending SIGKILL to remaining processes...");
broadcast_signal(SIGKILL, true, false);
- in_container = detect_container() > 0;
-
need_umount = !in_container;
need_swapoff = !in_container;
need_loop_detach = !in_container;
@@ -347,10 +351,10 @@ int main(int argc, char *argv[]) {
need_loop_detach ? " loop devices," : "",
need_dm_detach ? " DM devices," : "");
- /* 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. */
+ /* The kernel will automatically flush ATA disks and suchlike on reboot(), but the file systems need to be
+ * sync'ed explicitly in advance. So let's do this here, but not needlessly slow down containers. Note that we
+ * sync'ed things already once above, but we did some more work since then which might have caused IO, hence
+ * let's doit once more. */
if (!in_container)
sync();
diff --git a/src/grp-system/systemd-shutdown/systemd-shutdown.xml b/src/grp-system/systemd-shutdown/systemd-shutdown.xml
index 749158e5da..b1d1f87ce9 100644
--- a/src/grp-system/systemd-shutdown/systemd-shutdown.xml
+++ b/src/grp-system/systemd-shutdown/systemd-shutdown.xml
@@ -57,6 +57,7 @@
<para><filename>systemd-reboot.service</filename></para>
<para><filename>systemd-kexec.service</filename></para>
<para><filename>/usr/lib/systemd/systemd-shutdown</filename></para>
+ <para><filename>/usr/lib/systemd/system-shutdown/</filename></para>
</refsynopsisdiv>
<refsect1>