Commit 4e67ddd6 authored by Lennart Poettering's avatar Lennart Poettering
Browse files

units: introduce umount.target for unmounting all file systems

parent b8131a87
...@@ -126,6 +126,7 @@ dist_systemunit_DATA = \ ...@@ -126,6 +126,7 @@ dist_systemunit_DATA = \
units/rpcbind.target \ units/rpcbind.target \
units/rtc-set.target \ units/rtc-set.target \
units/shutdown.target \ units/shutdown.target \
units/umount.target \
units/sigpwr.target \ units/sigpwr.target \
units/sockets.target \ units/sockets.target \
units/swap.target \ units/swap.target \
......
...@@ -35,8 +35,6 @@ ...@@ -35,8 +35,6 @@
* selinux * selinux
* introduce umount.target
* pull in umount.target and shutdown.target from emergency.service (?) * pull in umount.target and shutdown.target from emergency.service (?)
* Show exit status auf auxiliary programs in systemctl status * Show exit status auf auxiliary programs in systemctl status
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "unit-name.h" #include "unit-name.h"
#include "dbus-automount.h" #include "dbus-automount.h"
#include "bus-errors.h" #include "bus-errors.h"
#include "special.h"
static const UnitActiveState state_translation_table[_AUTOMOUNT_STATE_MAX] = { static const UnitActiveState state_translation_table[_AUTOMOUNT_STATE_MAX] = {
[AUTOMOUNT_DEAD] = UNIT_INACTIVE, [AUTOMOUNT_DEAD] = UNIT_INACTIVE,
...@@ -194,6 +195,10 @@ static int automount_load(Unit *u) { ...@@ -194,6 +195,10 @@ static int automount_load(Unit *u) {
if ((r = unit_add_dependency(u, UNIT_BEFORE, UNIT(a->mount), true)) < 0) if ((r = unit_add_dependency(u, UNIT_BEFORE, UNIT(a->mount), true)) < 0)
return r; return r;
if (a->meta.default_dependencies)
if ((r = unit_add_two_dependencies_by_name(UNIT(a), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
return r;
} }
return automount_verify(a); return automount_verify(a);
......
...@@ -367,6 +367,10 @@ static int mount_load(Unit *u) { ...@@ -367,6 +367,10 @@ static int mount_load(Unit *u) {
if ((r = unit_add_default_cgroup(u)) < 0) if ((r = unit_add_default_cgroup(u)) < 0)
return r; return r;
if (m->meta.default_dependencies && !path_equal(m->where, "/"))
if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
return r;
} }
return mount_verify(m); return mount_verify(m);
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
* it to bring all services down that want to be brought down on * it to bring all services down that want to be brought down on
* system shutdown. */ * system shutdown. */
#define SPECIAL_SHUTDOWN_TARGET "shutdown.target" #define SPECIAL_SHUTDOWN_TARGET "shutdown.target"
#define SPECIAL_UMOUNT_TARGET "umount.target"
#define SPECIAL_LOGGER_SOCKET "systemd-logger.socket" #define SPECIAL_LOGGER_SOCKET "systemd-logger.socket"
......
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# See systemd.special(7) for details
[Unit]
Description=Unmount All Filesystems
OnlyByDependency=yes
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment