summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-10-28 03:38:52 +0200
committerLennart Poettering <lennart@poettering.net>2010-10-28 03:38:52 +0200
commitf14e15f8affe906a45d8afc76c302a49cd1f70ee (patch)
tree5af3ffd29e33fddde628d8a79ea7400a9025aaf6
parent799fd0fd23028a58e1f605c6b0d9aaab65b4fb1f (diff)
unit: replace recursive_stop by stop_retroactively to simplify things a little
-rw-r--r--man/systemd.unit.xml22
-rw-r--r--src/dbus-unit.h4
-rw-r--r--src/device.c6
-rw-r--r--src/load-fragment.c2
-rw-r--r--src/mount.c3
-rw-r--r--src/unit.c15
-rw-r--r--src/unit.h6
7 files changed, 28 insertions, 30 deletions
diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml
index f72b947dc..14da607a9 100644
--- a/man/systemd.unit.xml
+++ b/man/systemd.unit.xml
@@ -441,22 +441,24 @@
</varlistentry>
<varlistentry>
- <term><varname>RecursiveStop=</varname></term>
+ <term><varname>StopRetroactively=</varname></term>
<listitem><para>Takes a boolean
argument. If <option>true</option> and
- the unit stops without being requested
- by the user, all units
- depending on it will be stopped as
+ a unit this unit requires stops
+ without this being requested by the
+ user, this unit will be stopped as
well. (e.g. if a service exits or
- crashes on its own behalf, units using
- it will be stopped) Note that normally
- if a unit stops without a user request,
+ crashes on its own behalf, units this
+ flag is set for that require it will
+ be stopped.) Note that normally if a
+ unit stops without a user request,
units depending on it will not be
terminated. Only if the user requested
- shutdown of a unit, all units depending
- on that unit will be shut down as well
- and at the same time. Defaults to
+ shutdown of a unit, all units
+ depending on that unit will be shut
+ down as well and at the same
+ time. Defaults to
<option>false</option>.</para></listitem>
</varlistentry>
diff --git a/src/dbus-unit.h b/src/dbus-unit.h
index 94e084f6e..4a4d23e17 100644
--- a/src/dbus-unit.h
+++ b/src/dbus-unit.h
@@ -92,7 +92,7 @@
" <property name=\"CanStop\" type=\"b\" access=\"read\"/>\n" \
" <property name=\"CanIsolate\" type=\"b\" access=\"read\"/>\n" \
" <property name=\"Job\" type=\"(uo)\" access=\"read\"/>\n" \
- " <property name=\"RecursiveStop\" type=\"b\" access=\"read\"/>\n" \
+ " <property name=\"StopRetroactively\" type=\"b\" access=\"read\"/>\n" \
" <property name=\"StopWhenUnneeded\" type=\"b\" access=\"read\"/>\n" \
" <property name=\"RefuseManualStart\" type=\"b\" access=\"read\"/>\n" \
" <property name=\"RefuseManualStop\" type=\"b\" access=\"read\"/>\n" \
@@ -134,7 +134,7 @@
{ "org.freedesktop.systemd1.Unit", "CanReload", bus_unit_append_can_reload, "b", u }, \
{ "org.freedesktop.systemd1.Unit", "CanIsolate", bus_unit_append_can_isolate, "b", u }, \
{ "org.freedesktop.systemd1.Unit", "Job", bus_unit_append_job, "(uo)", u }, \
- { "org.freedesktop.systemd1.Unit", "RecursiveStop", bus_property_append_bool, "b", &u->meta.recursive_stop }, \
+ { "org.freedesktop.systemd1.Unit", "StopRetroactively", bus_property_append_bool, "b", &u->meta.stop_retroactively }, \
{ "org.freedesktop.systemd1.Unit", "StopWhenUnneeded", bus_property_append_bool, "b", &u->meta.stop_when_unneeded }, \
{ "org.freedesktop.systemd1.Unit", "RefuseManualStart", bus_property_append_bool, "b", &u->meta.refuse_manual_start }, \
{ "org.freedesktop.systemd1.Unit", "RefuseManualStop", bus_property_append_bool, "b", &u->meta.refuse_manual_stop }, \
diff --git a/src/device.c b/src/device.c
index 0ddd3b3d0..7b7311012 100644
--- a/src/device.c
+++ b/src/device.c
@@ -69,12 +69,6 @@ static void device_init(Unit *u) {
* happen for the other units since their operations time out
* anyway. */
d->meta.job_timeout = DEFAULT_TIMEOUT_USEC;
-
- /* We enable recursive stopping by default for all
- devices. This enables the user to use Requires= to make a
- service go a way when a device goes away, and Wants=
- otherwise. */
- d->meta.recursive_stop = true;
}
static void device_done(Unit *u) {
diff --git a/src/load-fragment.c b/src/load-fragment.c
index 74fe78647..bc3445106 100644
--- a/src/load-fragment.c
+++ b/src/load-fragment.c
@@ -1769,7 +1769,7 @@ static int load_from_path(Unit *u, const char *path) {
{ "Before", config_parse_deps, UINT_TO_PTR(UNIT_BEFORE), "Unit" },
{ "After", config_parse_deps, UINT_TO_PTR(UNIT_AFTER), "Unit" },
{ "OnFailure", config_parse_deps, UINT_TO_PTR(UNIT_ON_FAILURE), "Unit" },
- { "RecursiveStop", config_parse_bool, &u->meta.recursive_stop, "Unit" },
+ { "StopRetroactively", config_parse_bool, &u->meta.stop_retroactively, "Unit" },
{ "StopWhenUnneeded", config_parse_bool, &u->meta.stop_when_unneeded, "Unit" },
{ "RefuseManualStart", config_parse_bool, &u->meta.refuse_manual_start, "Unit" },
{ "RefuseManualStop", config_parse_bool, &u->meta.refuse_manual_stop, "Unit" },
diff --git a/src/mount.c b/src/mount.c
index d62ce8f40..0b67fbed5 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -70,6 +70,9 @@ static void mount_init(Unit *u) {
* already trying to comply its last one. */
m->exec_context.same_pgrp = true;
+ /* Make sure we unmount when the devices we require go away */
+ m->meta.stop_retroactively = true;
+
m->timer_watch.type = WATCH_INVALID;
m->control_command_id = _MOUNT_EXEC_COMMAND_INVALID;
diff --git a/src/unit.c b/src/unit.c
index 1775c1daf..f080e7bef 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -652,13 +652,13 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
if (u->meta.load_state == UNIT_LOADED) {
fprintf(f,
- "%s\tRecursive Stop: %s\n"
+ "%s\tStopRetroactively: %s\n"
"%s\tStopWhenUnneeded: %s\n"
"%s\tRefuseManualStart: %s\n"
"%s\tRefuseManualStop: %s\n"
"%s\tDefaultDependencies: %s\n"
"%s\tIgnoreDependencyFailure: %s\n",
- prefix, yes_no(u->meta.recursive_stop),
+ prefix, yes_no(u->meta.stop_retroactively),
prefix, yes_no(u->meta.stop_when_unneeded),
prefix, yes_no(u->meta.refuse_manual_start),
prefix, yes_no(u->meta.refuse_manual_stop),
@@ -1011,12 +1011,11 @@ static void retroactively_stop_dependencies(Unit *u) {
assert(u);
assert(UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(u)));
- if (u->meta.recursive_stop) {
- /* Pull down units need us recursively if enabled */
- SET_FOREACH(other, u->meta.dependencies[UNIT_REQUIRED_BY], i)
- if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
- manager_add_job(u->meta.manager, JOB_STOP, other, JOB_REPLACE, true, NULL, NULL);
- }
+ /* Pull down units which need us recursively if enabled */
+ SET_FOREACH(other, u->meta.dependencies[UNIT_REQUIRED_BY], i)
+ if (other->meta.stop_retroactively &&
+ !UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
+ manager_add_job(u->meta.manager, JOB_STOP, other, JOB_REPLACE, true, NULL, NULL);
/* Garbage collect services that might not be needed anymore, if enabled */
SET_FOREACH(other, u->meta.dependencies[UNIT_REQUIRES], i)
diff --git a/src/unit.h b/src/unit.h
index 3f0ef01c5..8b6b58e53 100644
--- a/src/unit.h
+++ b/src/unit.h
@@ -105,7 +105,7 @@ enum UnitDependency {
/* Inverse of the above */
UNIT_REQUIRED_BY, /* inverse of 'requires' and 'requisite' is 'required_by' */
- UNIT_REQUIRED_BY_OVERRIDABLE, /* inverse of 'soft_requires' and 'soft_requisite' is 'soft_required_by' */
+ UNIT_REQUIRED_BY_OVERRIDABLE, /* inverse of 'requires_overridable' and 'requisite_overridable' is 'soft_required_by' */
UNIT_WANTED_BY, /* inverse of 'wants' */
/* Negative dependencies */
@@ -191,8 +191,8 @@ struct Meta {
/* Error code when we didn't manage to load the unit (negative) */
int load_error;
- /* If we go down, pull down everything that depends on us, too */
- bool recursive_stop;
+ /* If some required dep goes down, pull down ourselves, too */
+ bool stop_retroactively;
/* Garbage collect us we nobody wants or requires us anymore */
bool stop_when_unneeded;