[systemd-commits] 7 commits - man/systemd.unit.xml src/automount.c src/dbus-unit.h src/load-fragment.c src/manager.c src/mount.c src/shutdown.c src/systemctl.c src/timer.c src/unit.c src/unit.h TODO units/fsck at .service.in units/getty at .service.m4 units/serial-getty at .service.m4 units/sysctl.service

Lennart Poettering lennart at kemper.freedesktop.org
Thu Oct 28 15:49:06 PDT 2010


 TODO                           |    4 --
 man/systemd.unit.xml           |   42 +++++++++++---------------
 src/automount.c                |   11 ++++++-
 src/dbus-unit.h                |    6 ++-
 src/load-fragment.c            |    2 -
 src/manager.c                  |   10 ++++++
 src/mount.c                    |    3 -
 src/shutdown.c                 |   64 +++++++++++++++++++++++------------------
 src/systemctl.c                |    4 +-
 src/timer.c                    |    4 --
 src/unit.c                     |   50 +++++++++++++++++++++++---------
 src/unit.h                     |    5 +--
 units/fsck at .service.in         |    2 -
 units/getty at .service.m4        |    2 -
 units/serial-getty at .service.m4 |    2 -
 units/sysctl.service           |    1 
 16 files changed, 126 insertions(+), 86 deletions(-)

New commits:
commit b81884e7466b8e8bc1261b1b1a722d11694b8c54
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Oct 28 23:18:47 2010 +0200

    unit: replace StopRetroactively= by BindTo= dependencies
    
    The property StopRetroactively= needs to be per-dependency, not
    per-unit, in order to properly express dependencies between .mount units
    and its .device and fsck .service units. If the .device unit is
    unplugged the mount should go away, but if the fsck process terminates
    the .mount should stay.

diff --git a/TODO b/TODO
index a01f2a9..0d6ac5f 100644
--- a/TODO
+++ b/TODO
@@ -70,7 +70,7 @@
 
 * only add quotacheck deps to .mount units which mention grpquota/usrquota in the mount flags
 
-* Introduce weaker Conflicts.
+* Introduce weaker Conflicts. get rid of ignore_dependency_failure
 
 External:
 
diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml
index 14da607..ff1b47f 100644
--- a/man/systemd.unit.xml
+++ b/man/systemd.unit.xml
@@ -281,7 +281,6 @@
                                 services.</para></listitem>
                         </varlistentry>
 
-
                         <varlistentry>
                                 <term><varname>RequiresOverridable=</varname></term>
 
@@ -341,6 +340,23 @@
                         </varlistentry>
 
                         <varlistentry>
+                                <term><varname>BindTo=</varname></term>
+
+                                <listitem><para>Configures requirement
+                                dependencies, very similar in style to
+                                <varname>Requires=</varname>, however
+                                in addition to this behaviour it also
+                                declares that this unit is stopped
+                                when any of the units listed suddenly
+                                disappears. Units can suddenly,
+                                unexpectedly disappear if a service
+                                terminates on its own choice, a device
+                                is unplugged or a mount point
+                                unmounted with involvement of
+                                systemd.</para></listitem>
+                        </varlistentry>
+
+                        <varlistentry>
                                 <term><varname>Conflicts=</varname></term>
 
                                 <listitem><para>Configures negative
@@ -441,28 +457,6 @@
                         </varlistentry>
 
                         <varlistentry>
-                                <term><varname>StopRetroactively=</varname></term>
-
-                                <listitem><para>Takes a boolean
-                                argument. If <option>true</option> and
-                                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 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
-                                <option>false</option>.</para></listitem>
-                        </varlistentry>
-
-                        <varlistentry>
                                 <term><varname>StopWhenUnneeded=</varname></term>
 
                                 <listitem><para>Takes a boolean
@@ -630,7 +624,7 @@
                                 side matching. If multiple conditions
                                 are specified the unit will be
                                 executed iff at least one of them
-                                apply (i.e. a logical OR is
+                                applies (i.e. a logical OR is
                                 applied).</para></listitem>
                         </varlistentry>
                 </variablelist>
diff --git a/src/dbus-unit.h b/src/dbus-unit.h
index 4a4d23e..d897ef8 100644
--- a/src/dbus-unit.h
+++ b/src/dbus-unit.h
@@ -70,9 +70,11 @@
         "  <property name=\"Requisite\" type=\"as\" access=\"read\"/>\n" \
         "  <property name=\"RequisiteOverridable\" type=\"as\" access=\"read\"/>\n" \
         "  <property name=\"Wants\" type=\"as\" access=\"read\"/>\n"    \
+        "  <property name=\"BindTo\" type=\"as\" access=\"read\"/>\n"    \
         "  <property name=\"RequiredBy\" type=\"as\" access=\"read\"/>\n" \
         "  <property name=\"RequiredByOverridable\" type=\"as\" access=\"read\"/>\n" \
         "  <property name=\"WantedBy\" type=\"as\" access=\"read\"/>\n" \
+        "  <property name=\"BoundBy\" type=\"as\" access=\"read\"/>\n" \
         "  <property name=\"Conflicts\" type=\"as\" access=\"read\"/>\n" \
         "  <property name=\"ConflictedBy\" type=\"as\" access=\"read\"/>\n" \
         "  <property name=\"Before\" type=\"as\" access=\"read\"/>\n"   \
@@ -92,7 +94,6 @@
         "  <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=\"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" \
@@ -112,9 +113,11 @@
         { "org.freedesktop.systemd1.Unit", "Requisite",            bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_REQUISITE] }, \
         { "org.freedesktop.systemd1.Unit", "RequisiteOverridable", bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_REQUISITE_OVERRIDABLE] }, \
         { "org.freedesktop.systemd1.Unit", "Wants",                bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_WANTS]  }, \
+        { "org.freedesktop.systemd1.Unit", "BindTo",               bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_BIND_TO]  }, \
         { "org.freedesktop.systemd1.Unit", "RequiredBy",           bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_REQUIRED_BY] }, \
         { "org.freedesktop.systemd1.Unit", "RequiredByOverridable",bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_REQUIRED_BY_OVERRIDABLE] }, \
         { "org.freedesktop.systemd1.Unit", "WantedBy",             bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_WANTED_BY] }, \
+        { "org.freedesktop.systemd1.Unit", "BoundBy",              bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_BOUND_BY]  }, \
         { "org.freedesktop.systemd1.Unit", "Conflicts",            bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_CONFLICTS] }, \
         { "org.freedesktop.systemd1.Unit", "ConflictedBy",         bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_CONFLICTED_BY] }, \
         { "org.freedesktop.systemd1.Unit", "Before",               bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_BEFORE] }, \
@@ -134,7 +137,6 @@
         { "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", "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/load-fragment.c b/src/load-fragment.c
index bc34451..828b8d2 100644
--- a/src/load-fragment.c
+++ b/src/load-fragment.c
@@ -1765,11 +1765,11 @@ static int load_from_path(Unit *u, const char *path) {
                 { "Requisite",              config_parse_deps,            UINT_TO_PTR(UNIT_REQUISITE),                     "Unit"    },
                 { "RequisiteOverridable",   config_parse_deps,            UINT_TO_PTR(UNIT_REQUISITE_OVERRIDABLE),         "Unit"    },
                 { "Wants",                  config_parse_deps,            UINT_TO_PTR(UNIT_WANTS),                         "Unit"    },
+                { "BindTo",                 config_parse_deps,            UINT_TO_PTR(UNIT_BIND_TO),                       "Unit"    },
                 { "Conflicts",              config_parse_deps,            UINT_TO_PTR(UNIT_CONFLICTS),                     "Unit"    },
                 { "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"    },
-                { "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/manager.c b/src/manager.c
index 667be2f..796d3cb 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -1446,6 +1446,10 @@ static int transaction_add_job_and_dependencies(
                                 if ((r = transaction_add_job_and_dependencies(m, JOB_START, dep, ret, true, override, false, e, NULL)) < 0 && r != -EBADR)
                                         goto fail;
 
+                        SET_FOREACH(dep, ret->unit->meta.dependencies[UNIT_BIND_TO], i)
+                                if ((r = transaction_add_job_and_dependencies(m, JOB_START, dep, ret, true, override, false, e, NULL)) < 0 && r != -EBADR)
+                                        goto fail;
+
                         SET_FOREACH(dep, ret->unit->meta.dependencies[UNIT_REQUIRES_OVERRIDABLE], i)
                                 if ((r = transaction_add_job_and_dependencies(m, JOB_START, dep, ret, !override, override, false, e, NULL)) < 0 && r != -EBADR) {
                                         log_warning("Cannot add dependency job for unit %s, ignoring: %s", dep->meta.id, bus_error(e, r));
@@ -1487,6 +1491,10 @@ static int transaction_add_job_and_dependencies(
                         SET_FOREACH(dep, ret->unit->meta.dependencies[UNIT_REQUIRED_BY], i)
                                 if ((r = transaction_add_job_and_dependencies(m, type, dep, ret, true, override, false, e, NULL)) < 0 && r != -EBADR)
                                         goto fail;
+
+                        SET_FOREACH(dep, ret->unit->meta.dependencies[UNIT_BOUND_BY], i)
+                                if ((r = transaction_add_job_and_dependencies(m, type, dep, ret, true, override, false, e, NULL)) < 0 && r != -EBADR)
+                                        goto fail;
                 }
 
                 /* JOB_VERIFY_STARTED, JOB_RELOAD require no dependency handling */
diff --git a/src/mount.c b/src/mount.c
index 0b67fbe..d62ce8f 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -70,9 +70,6 @@ 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 f080e7b..fb5583b 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -652,13 +652,11 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
 
         if (u->meta.load_state == UNIT_LOADED) {
                 fprintf(f,
-                        "%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.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),
@@ -768,6 +766,10 @@ static int unit_add_default_dependencies(Unit *u) {
                 if ((r = unit_add_default_target_dependency(u, target)) < 0)
                         return r;
 
+        SET_FOREACH(target, u->meta.dependencies[UNIT_BOUND_BY], i)
+                if ((r = unit_add_default_target_dependency(u, target)) < 0)
+                        return r;
+
         return 0;
 }
 
@@ -966,6 +968,10 @@ static void unit_check_unneeded(Unit *u) {
                 if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
                         return;
 
+        SET_FOREACH(other, u->meta.dependencies[UNIT_BOUND_BY], i)
+                if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
+                        return;
+
         log_info("Service %s is not needed anymore. Stopping.", u->meta.id);
 
         /* Ok, nobody needs us anymore. Sniff. Then let's commit suicide */
@@ -980,27 +986,36 @@ static void retroactively_start_dependencies(Unit *u) {
         assert(UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(u)));
 
         SET_FOREACH(other, u->meta.dependencies[UNIT_REQUIRES], i)
-                if (!UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
+                if (!set_get(u->meta.dependencies[UNIT_AFTER], other) &&
+                    !UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
+                        manager_add_job(u->meta.manager, JOB_START, other, JOB_REPLACE, true, NULL, NULL);
+
+        SET_FOREACH(other, u->meta.dependencies[UNIT_BIND_TO], i)
+                if (!set_get(u->meta.dependencies[UNIT_AFTER], other) &&
+                    !UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
                         manager_add_job(u->meta.manager, JOB_START, other, JOB_REPLACE, true, NULL, NULL);
 
         SET_FOREACH(other, u->meta.dependencies[UNIT_REQUIRES_OVERRIDABLE], i)
-                if (!UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
+                if (!set_get(u->meta.dependencies[UNIT_AFTER], other) &&
+                    !UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
                         manager_add_job(u->meta.manager, JOB_START, other, JOB_FAIL, false, NULL, NULL);
 
         SET_FOREACH(other, u->meta.dependencies[UNIT_REQUISITE], i)
-                if (!UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
+                if (!set_get(u->meta.dependencies[UNIT_AFTER], other) &&
+                    !UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
                         manager_add_job(u->meta.manager, JOB_START, other, JOB_REPLACE, true, NULL, NULL);
 
         SET_FOREACH(other, u->meta.dependencies[UNIT_WANTS], i)
-                if (!UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
+                if (!set_get(u->meta.dependencies[UNIT_AFTER], other) &&
+                    !UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
                         manager_add_job(u->meta.manager, JOB_START, other, JOB_FAIL, false, NULL, NULL);
 
         SET_FOREACH(other, u->meta.dependencies[UNIT_CONFLICTS], i)
-                if (!UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
+                if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
                         manager_add_job(u->meta.manager, JOB_STOP, other, JOB_REPLACE, true, NULL, NULL);
 
         SET_FOREACH(other, u->meta.dependencies[UNIT_CONFLICTED_BY], i)
-                if (!UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
+                if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
                         manager_add_job(u->meta.manager, JOB_STOP, other, JOB_REPLACE, true, NULL, NULL);
 }
 
@@ -1011,10 +1026,9 @@ static void retroactively_stop_dependencies(Unit *u) {
         assert(u);
         assert(UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(u)));
 
-        /* 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)))
+        /* Pull down units which are bound to us recursively if enabled */
+        SET_FOREACH(other, u->meta.dependencies[UNIT_BOUND_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);
 
         /* Garbage collect services that might not be needed anymore, if enabled */
@@ -1033,6 +1047,9 @@ static void retroactively_stop_dependencies(Unit *u) {
         SET_FOREACH(other, u->meta.dependencies[UNIT_REQUISITE_OVERRIDABLE], i)
                 if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
                         unit_check_unneeded(other);
+        SET_FOREACH(other, u->meta.dependencies[UNIT_BIND_TO], i)
+                if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
+                        unit_check_unneeded(other);
 }
 
 void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) {
@@ -1397,9 +1414,11 @@ int unit_add_dependency(Unit *u, UnitDependency d, Unit *other, bool add_referen
                 [UNIT_WANTS] = UNIT_WANTED_BY,
                 [UNIT_REQUISITE] = UNIT_REQUIRED_BY,
                 [UNIT_REQUISITE_OVERRIDABLE] = UNIT_REQUIRED_BY_OVERRIDABLE,
+                [UNIT_BIND_TO] = UNIT_BOUND_BY,
                 [UNIT_REQUIRED_BY] = _UNIT_DEPENDENCY_INVALID,
                 [UNIT_REQUIRED_BY_OVERRIDABLE] = _UNIT_DEPENDENCY_INVALID,
                 [UNIT_WANTED_BY] = _UNIT_DEPENDENCY_INVALID,
+                [UNIT_BOUND_BY] = UNIT_BIND_TO,
                 [UNIT_CONFLICTS] = UNIT_CONFLICTED_BY,
                 [UNIT_CONFLICTED_BY] = UNIT_CONFLICTS,
                 [UNIT_BEFORE] = UNIT_AFTER,
@@ -1426,7 +1445,8 @@ int unit_add_dependency(Unit *u, UnitDependency d, Unit *other, bool add_referen
             (d == UNIT_REQUIRES ||
              d == UNIT_REQUIRES_OVERRIDABLE ||
              d == UNIT_REQUISITE ||
-             d == UNIT_REQUISITE_OVERRIDABLE)) {
+             d == UNIT_REQUISITE_OVERRIDABLE ||
+             d == UNIT_BIND_TO)) {
                     return -EINVAL;
         }
 
@@ -2129,7 +2149,7 @@ int unit_add_node_link(Unit *u, const char *what, bool wants) {
         if (r < 0)
                 return r;
 
-        if ((r = unit_add_two_dependencies(u, UNIT_AFTER, UNIT_REQUIRES, device, true)) < 0)
+        if ((r = unit_add_two_dependencies(u, UNIT_AFTER, UNIT_BIND_TO, device, true)) < 0)
                 return r;
 
         if (wants)
@@ -2313,9 +2333,11 @@ static const char* const unit_dependency_table[_UNIT_DEPENDENCY_MAX] = {
         [UNIT_REQUISITE_OVERRIDABLE] = "RequisiteOverridable",
         [UNIT_REQUIRED_BY] = "RequiredBy",
         [UNIT_REQUIRED_BY_OVERRIDABLE] = "RequiredByOverridable",
+        [UNIT_BIND_TO] = "BindTo",
         [UNIT_WANTED_BY] = "WantedBy",
         [UNIT_CONFLICTS] = "Conflicts",
         [UNIT_CONFLICTED_BY] = "ConflictedBy",
+        [UNIT_BOUND_BY] = "BoundBy",
         [UNIT_BEFORE] = "Before",
         [UNIT_AFTER] = "After",
         [UNIT_REFERENCES] = "References",
diff --git a/src/unit.h b/src/unit.h
index 8b6b58e..ff11511 100644
--- a/src/unit.h
+++ b/src/unit.h
@@ -102,11 +102,13 @@ enum UnitDependency {
         UNIT_REQUISITE,
         UNIT_REQUISITE_OVERRIDABLE,
         UNIT_WANTS,
+        UNIT_BIND_TO,
 
         /* Inverse of the above */
         UNIT_REQUIRED_BY,             /* inverse of 'requires' and 'requisite' is 'required_by' */
         UNIT_REQUIRED_BY_OVERRIDABLE, /* inverse of 'requires_overridable' and 'requisite_overridable' is 'soft_required_by' */
         UNIT_WANTED_BY,               /* inverse of 'wants' */
+        UNIT_BOUND_BY,                /* inverse of 'bind_to' */
 
         /* Negative dependencies */
         UNIT_CONFLICTS,               /* inverse of 'conflicts' is 'conflicted_by' */
@@ -191,9 +193,6 @@ struct Meta {
         /* Error code when we didn't manage to load the unit (negative) */
         int load_error;
 
-        /* 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;
 
diff --git a/units/fsck at .service.in b/units/fsck at .service.in
index 54caa3c..3881541 100644
--- a/units/fsck at .service.in
+++ b/units/fsck at .service.in
@@ -8,7 +8,7 @@
 [Unit]
 Description=File System Check on %f
 DefaultDependencies=no
-Requires=%i.device
+BindTo=%i.device
 After=systemd-readahead-collect.service systemd-readahead-replay.service %i.device
 Before=local-fs.target shutdown.target
 
diff --git a/units/getty at .service.m4 b/units/getty at .service.m4
index 98c6a88..1edcad9 100644
--- a/units/getty at .service.m4
+++ b/units/getty at .service.m4
@@ -14,7 +14,7 @@ m4_ifdef(`TARGET_ARCH', `m4_define(`GETTY', `/sbin/agetty -8 38400')')m4_dnl
 m4_dnl
 [Unit]
 Description=Getty on %I
-Requires=dev-%i.device
+BindTo=dev-%i.device
 After=dev-%i.device
 m4_ifdef(`TARGET_FEDORA',
 After=rc-local.service
diff --git a/units/serial-getty at .service.m4 b/units/serial-getty at .service.m4
index 9a70db0..da9bd19 100644
--- a/units/serial-getty at .service.m4
+++ b/units/serial-getty at .service.m4
@@ -7,7 +7,7 @@
 
 [Unit]
 Description=Serial Getty on %I
-Requires=dev-%i.device
+BindTo=dev-%i.device
 After=dev-%i.device
 m4_ifdef(`TARGET_FEDORA',
 After=rc-local.service

commit 941a4041bdb9d91e9d5033005263efe029621e4f
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Oct 28 22:20:01 2010 +0200

    automount: show who's triggering an automount

diff --git a/src/automount.c b/src/automount.c
index c557b6e..da66630 100644
--- a/src/automount.c
+++ b/src/automount.c
@@ -760,7 +760,16 @@ static void automount_fd_event(Unit *u, int fd, uint32_t events, Watch *w) {
         switch (packet.hdr.type) {
 
         case autofs_ptype_missing_direct:
-                log_debug("Got direct mount request for %s", packet.v5_packet.name);
+
+                if (packet.v5_packet.pid > 0) {
+                        char *p = NULL;
+
+                        get_process_name(packet.v5_packet.pid, &p);
+                        log_debug("Got direct mount request for %s, triggered by %lu (%s)", packet.v5_packet.name, (unsigned long) packet.v5_packet.pid, strna(p));
+                        free(p);
+
+                } else
+                        log_debug("Got direct mount request for %s", packet.v5_packet.name);
 
                 if (!a->tokens)
                         if (!(a->tokens = set_new(trivial_hash_func, trivial_compare_func))) {

commit c858849d45ff94d66c79a414b6a2ef9db1fe1979
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Oct 28 22:12:05 2010 +0200

    units: run sysctl only if /etc/sysctl.conf exists

diff --git a/units/sysctl.service b/units/sysctl.service
index afde580..ba5626a 100644
--- a/units/sysctl.service
+++ b/units/sysctl.service
@@ -11,6 +11,7 @@ DefaultDependencies=no
 Conflicts=shutdown.target
 After=systemd-readahead-collect.service systemd-readahead-replay.service
 Before=basic.target shutdown.target
+ConditionPathExists=/etc/sysctl.conf
 
 [Service]
 Type=oneshot

commit 9feeba4bbb768a2564520b5d3e238c44fb3f6c7b
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Oct 28 22:11:45 2010 +0200

    systemctl: always show what and where for mount units in status output

diff --git a/src/systemctl.c b/src/systemctl.c
index d710bcf..4f4b6dd 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -1820,9 +1820,9 @@ static void print_status_info(UnitStatusInfo *i) {
 
         if (i->sysfs_path)
                 printf("\t  Device: %s\n", i->sysfs_path);
-        else if (i->where)
+        if (i->where)
                 printf("\t   Where: %s\n", i->where);
-        else if (i->what)
+        if (i->what)
                 printf("\t    What: %s\n", i->what);
 
         if (i->accept)

commit ab58e29119798f9f15a537fcd31119342db177a2
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Oct 28 22:11:26 2010 +0200

    shutdown: reword a few messages a little

diff --git a/src/shutdown.c b/src/shutdown.c
index e8d2501..35426d2 100644
--- a/src/shutdown.c
+++ b/src/shutdown.c
@@ -108,19 +108,21 @@ static int send_signal(int sign) {
                 return -errno;
 
         if (kill(-1, SIGSTOP) < 0)
-                log_warning("Failed kill(-1, SIGSTOP): %m");
+                log_warning("kill(-1, SIGSTOP) failed: %m");
 
         n_processes = killall(sign);
 
         if (kill(-1, SIGCONT) < 0)
-                log_warning("Failed kill(-1, SIGCONT): %m");
+                log_warning("kill(-1, SIGCONT) failed: %m");
 
         if (n_processes <= 0)
                 goto finish;
 
         until = now(CLOCK_MONOTONIC) + TIMEOUT_USEC;
         for (;;) {
+                int k;
                 usec_t n = now(CLOCK_MONOTONIC);
+
                 for (;;) {
                         pid_t pid = waitpid(-1, NULL, WNOHANG);
 
@@ -139,9 +141,12 @@ static int send_signal(int sign) {
                         goto finish;
 
                 timespec_store(&ts, until - n);
-                if (sigtimedwait(&mask, NULL, &ts) != SIGCHLD)
-                        if (errno != EAGAIN)
-                                log_warning("Failed: sigtimedwait did not return SIGCHLD: %m");
+                if ((k = sigtimedwait(&mask, NULL, &ts)) != SIGCHLD) {
+                        if (k >= 0)
+                                log_warning("sigtimedwait() returned unexpected signal.");
+                        if (k < 0 && errno != EAGAIN)
+                                log_warning("sigtimedwait() failed: %m");
+                }
         }
 
 finish:
@@ -162,21 +167,23 @@ static int rescue_send_signal(int sign) {
                 return -errno;
 
         if (kill(-1, SIGSTOP) < 0)
-                log_warning("Failed kill(-1, SIGSTOP): %m");
+                log_warning("kill(-1, SIGSTOP) failed: %m");
 
         r = kill(-1, sign);
         if (r < 0)
-                log_warning("Failed kill(-1, %d): %m", sign);
+                log_warning("kill(-1, %d) failed: %m", sign);
 
         if (kill(-1, SIGCONT) < 0)
-                log_warning("Failed kill(-1, SIGCONT): %m");
+                log_warning("kill(-1, SIGCONT) failed: %m");
 
         if (r < 0)
                 goto finish;
 
         until = now(CLOCK_MONOTONIC) + TIMEOUT_USEC;
         for (;;) {
+                int k;
                 usec_t n = now(CLOCK_MONOTONIC);
+
                 for (;;) {
                         pid_t pid = waitpid(-1, NULL, WNOHANG);
                         if (pid == 0)
@@ -189,9 +196,12 @@ static int rescue_send_signal(int sign) {
                         goto finish;
 
                 timespec_store(&ts, until - n);
-                if (sigtimedwait(&mask, NULL, &ts) != SIGCHLD)
-                        if (errno != EAGAIN)
-                                log_warning("Failed: sigtimedwait did not return SIGCHLD: %m");
+                if ((k = sigtimedwait(&mask, NULL, &ts)) != SIGCHLD) {
+                        if (k >= 0)
+                                log_warning("sigtimedwait() returned unexpected signal.");
+                        if (k < 0 && errno != EAGAIN)
+                                log_warning("sigtimedwait() failed: %m");
+                }
         }
 
 finish:
@@ -240,29 +250,29 @@ int main(int argc, char *argv[]) {
         if (mlockall(MCL_CURRENT|MCL_FUTURE) != 0)
                 log_warning("Cannot lock process memory: %m");
 
-        log_info("Sending SIGTERM to processes");
+        log_info("Sending SIGTERM to remaining processes...");
         r = send_signal(SIGTERM);
         if (r < 0)
-                log_warning("Cannot send SIGTERM to all process: %s", strerror(r));
+                log_warning("Failed to send SIGTERM to remaining processes: %s", strerror(r));
 
-        log_info("Sending SIGKILL to processes");
+        log_info("Sending SIGKILL to remaining processes...");
         r = send_signal(SIGKILL);
         if (r < 0)
-                log_warning("Cannot send SIGKILL to all process: %s", strerror(r));
+                log_warning("Failed to send SIGKILL to remaining processes: %s", strerror(r));
 
         /* Unmount all mountpoints, swaps, and loopback devices */
         for (retries = 0; retries < FINALIZE_ATTEMPTS; retries++) {
                 bool changed = false;
 
                 if (need_umount) {
-                        log_info("Unmounting filesystems.");
+                        log_info("Unmounting file systems.");
                         r = umount_all(&changed);
                         if (r == 0)
                                 need_umount = false;
                         else if (r > 0)
-                                log_warning("Not all filesystems unmounted, %d left.", r);
+                                log_info("Not all file systems unmounted, %d left.", r);
                         else
-                                log_error("Error unmounting filesystems: %s", strerror(-r));
+                                log_error("Failed to unmount file systems: %s", strerror(-r));
                 }
 
                 if (need_swapoff) {
@@ -271,9 +281,9 @@ int main(int argc, char *argv[]) {
                         if (r == 0)
                                 need_swapoff = false;
                         else if (r > 0)
-                                log_warning("Not all swaps are off, %d left.", r);
+                                log_info("Not all swaps are turned off, %d left.", r);
                         else
-                                log_error("Error turning off swaps: %s", strerror(-r));
+                                log_error("Failed to turn off swaps: %s", strerror(-r));
                 }
 
                 if (need_loop_detach) {
@@ -282,9 +292,9 @@ int main(int argc, char *argv[]) {
                         if (r == 0)
                                 need_loop_detach = false;
                         else if (r > 0)
-                                log_warning("Not all loop devices detached, %d left.", r);
+                                log_info("Not all loop devices detached, %d left.", r);
                         else
-                                log_error("Error detaching loop devices: %s", strerror(-r));
+                                log_error("Failed to detach loop devices: %s", strerror(-r));
                 }
 
                 if (need_dm_detach) {
@@ -293,9 +303,9 @@ int main(int argc, char *argv[]) {
                         if (r == 0)
                                 need_dm_detach = false;
                         else if (r > 0)
-                                log_warning("Not all dm devices detached, %d left.", r);
+                                log_warning("Not all DM devices detached, %d left.", r);
                         else
-                                log_error("Error detaching dm devices: %s", strerror(-r));
+                                log_error("Failed to detach DM devices: %s", strerror(-r));
                 }
 
                 if (!need_umount && !need_swapoff && !need_loop_detach && !need_dm_detach)
@@ -310,17 +320,17 @@ int main(int argc, char *argv[]) {
                         if (killed_everbody) {
                                 /* Hmm, we already killed everybody,
                                  * let's just give up */
-                                log_error("Cannot finalize all filesystems and devices, giving up.");
+                                log_error("Cannot finalize remaining file systems and devices, giving up.");
                                 break;
                         }
 
-                        log_warning("Cannot finalize filesystems and devices, trying to kill remaining processes.");
+                        log_warning("Cannot finalize remaining file systems and devices, trying to kill remaining processes.");
                         rescue_send_signal(SIGTERM);
                         rescue_send_signal(SIGKILL);
                         killed_everbody = true;
                 }
 
-                log_debug("Couldn't finalize filesystems and devices after %u retries, trying again.", retries+1);
+                log_debug("Couldn't finalize remaining file systems and devices after %u retries, trying again.", retries+1);
         }
 
         if (retries >= FINALIZE_ATTEMPTS)

commit 28c3247e7908c3625118fc374475cb08f2ce79d1
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Oct 28 04:05:09 2010 +0200

    manager: show which jobs are actually installed after a transaction

diff --git a/src/manager.c b/src/manager.c
index b6a1da7..667be2f 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -1198,6 +1198,8 @@ static int transaction_apply(Manager *m) {
                 job_add_to_run_queue(j);
                 job_add_to_dbus_queue(j);
                 job_start_timer(j);
+
+                log_debug("Installed new job %s/%s as %u", j->unit->meta.id, job_type_to_string(j->type), (unsigned) j->id);
         }
 
         /* As last step, kill all remaining job dependencies. */

commit b363ca6f206258acff8bc0a27dc72a99210011a8
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Oct 28 04:04:50 2010 +0200

    timer: when deserializing timer state stay elapsed when we are elapsed

diff --git a/TODO b/TODO
index 67d397e..a01f2a9 100644
--- a/TODO
+++ b/TODO
@@ -64,8 +64,6 @@
 
 * parse early boot time env var from dracut
 
-* add switch to disable pull in retroactively
-
 * cryptsetup
 
 * add seperate man page for [Install] settings
diff --git a/src/timer.c b/src/timer.c
index b01944c..627a360 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -161,9 +161,7 @@ static int timer_coldplug(Unit *u) {
 
         if (t->deserialized_state != t->state) {
 
-                if (t->deserialized_state == TIMER_WAITING ||
-                    t->deserialized_state == TIMER_RUNNING ||
-                    t->deserialized_state == TIMER_ELAPSED)
+                if (t->deserialized_state == TIMER_WAITING)
                         timer_enter_waiting(t, false);
                 else
                         timer_set_state(t, t->deserialized_state);



More information about the systemd-commits mailing list