[systemd-commits] 3 commits - man/systemd.unit.xml src/cgroup.c src/dbus-unit.h src/load-fragment-gperf.gperf.m4 src/manager.c src/service.c src/shutdown.c src/unit.c src/unit.h
Lennart Poettering
lennart at kemper.freedesktop.org
Tue Jan 10 17:53:14 PST 2012
man/systemd.unit.xml | 16 ++++++++++++++++
src/cgroup.c | 3 +++
src/dbus-unit.h | 6 ++++++
src/load-fragment-gperf.gperf.m4 | 2 ++
src/manager.c | 18 +++++++++++++++++-
src/service.c | 10 ++++++++++
src/shutdown.c | 4 +++-
src/unit.c | 8 ++++++--
src/unit.h | 4 ++++
9 files changed, 67 insertions(+), 4 deletions(-)
New commits:
commit 4dcc1cb4155c4a72155e36a5461ab0847d4f1bf1
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Jan 11 02:47:14 2012 +0100
unit: implement new PropagateReloadTo=/PropagateReloadFrom= operations
diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml
index 897f99f..30559b9 100644
--- a/man/systemd.unit.xml
+++ b/man/systemd.unit.xml
@@ -510,6 +510,22 @@
</varlistentry>
<varlistentry>
+ <term><varname>PropagateReloadTo=</varname></term>
+ <term><varname>PropagateReloadFrom=</varname></term>
+
+ <listitem><para>Lists one or more
+ units where reload requests on the
+ unit will be propagated to/on the
+ other unit will be propagated
+ from. Issuing a reload request on a
+ unit will automatically also enqueue a
+ reload request on all units that the
+ reload request shall be propagated to
+ via these two
+ settings.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><varname>OnFailureIsolate=</varname></term>
<listitem><para>Takes a boolean
diff --git a/src/dbus-unit.h b/src/dbus-unit.h
index 20d5506..7a43410 100644
--- a/src/dbus-unit.h
+++ b/src/dbus-unit.h
@@ -80,6 +80,10 @@
" <property name=\"Before\" type=\"as\" access=\"read\"/>\n" \
" <property name=\"After\" type=\"as\" access=\"read\"/>\n" \
" <property name=\"OnFailure\" type=\"as\" access=\"read\"/>\n" \
+ " <property name=\"Triggers\" type=\"as\" access=\"read\"/>\n" \
+ " <property name=\"TriggeredBy\" type=\"as\" access=\"read\"/>\n" \
+ " <property name=\"PropagateReloadTo\" type=\"as\" access=\"read\"/>\n" \
+ " <property name=\"PropagateReloadFrom\" type=\"as\" access=\"read\"/>\n" \
" <property name=\"Description\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"LoadState\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"ActiveState\" type=\"s\" access=\"read\"/>\n" \
@@ -143,6 +147,8 @@
{ "org.freedesktop.systemd1.Unit", "OnFailure", bus_unit_append_dependencies, "as", u->meta.dependencies[UNIT_ON_FAILURE] }, \
{ "org.freedesktop.systemd1.Unit", "Triggers", bus_unit_append_dependencies, "as", u->meta.dependencies[UNIT_TRIGGERS] }, \
{ "org.freedesktop.systemd1.Unit", "TriggeredBy", bus_unit_append_dependencies, "as", u->meta.dependencies[UNIT_TRIGGERED_BY] }, \
+ { "org.freedesktop.systemd1.Unit", "PropagateReloadTo", bus_unit_append_dependencies, "as", u->meta.dependencies[UNIT_PROPAGATE_RELOAD_TO] }, \
+ { "org.freedesktop.systemd1.Unit", "PropagateReloadFrom", bus_unit_append_dependencies, "as", u->meta.dependencies[UNIT_PROPAGATE_RELOAD_FROM] }, \
{ "org.freedesktop.systemd1.Unit", "Description", bus_unit_append_description, "s", u }, \
{ "org.freedesktop.systemd1.Unit", "LoadState", bus_unit_append_load_state, "s", &u->meta.load_state }, \
{ "org.freedesktop.systemd1.Unit", "ActiveState", bus_unit_append_active_state, "s", u }, \
diff --git a/src/load-fragment-gperf.gperf.m4 b/src/load-fragment-gperf.gperf.m4
index 81e186c..11e6324 100644
--- a/src/load-fragment-gperf.gperf.m4
+++ b/src/load-fragment-gperf.gperf.m4
@@ -100,6 +100,8 @@ Unit.Conflicts, config_parse_unit_deps, UNIT_CONFLI
Unit.Before, config_parse_unit_deps, UNIT_BEFORE, 0
Unit.After, config_parse_unit_deps, UNIT_AFTER, 0
Unit.OnFailure, config_parse_unit_deps, UNIT_ON_FAILURE, 0
+Unit.PropagateReloadTo, config_parse_unit_deps, UNIT_PROPAGATE_RELOAD_TO, 0
+Unit.PropagateReloadFrom, config_parse_unit_deps, UNIT_PROPAGATE_RELOAD_FROM, 0
Unit.StopWhenUnneeded, config_parse_bool, 0, offsetof(Meta, stop_when_unneeded)
Unit.RefuseManualStart, config_parse_bool, 0, offsetof(Meta, refuse_manual_start)
Unit.RefuseManualStop, config_parse_bool, 0, offsetof(Meta, refuse_manual_stop)
diff --git a/src/manager.c b/src/manager.c
index 7fd860e..dbcd630 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -1610,7 +1610,9 @@ static int transaction_add_job_and_dependencies(
dbus_error_free(e);
}
- } else if (type == JOB_STOP || type == JOB_RESTART || type == JOB_TRY_RESTART) {
+ }
+
+ if (type == JOB_STOP || type == JOB_RESTART || type == JOB_TRY_RESTART) {
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, false, ignore_order, e, NULL)) < 0) {
@@ -1633,6 +1635,20 @@ static int transaction_add_job_and_dependencies(
}
}
+ if (type == JOB_RELOAD || type == JOB_RELOAD_OR_START) {
+
+ SET_FOREACH(dep, ret->unit->meta.dependencies[UNIT_PROPAGATE_RELOAD_TO], i) {
+ r = transaction_add_job_and_dependencies(m, JOB_RELOAD, dep, ret, false, override, false, false, ignore_order, e, NULL);
+
+ if (r < 0) {
+ log_warning("Cannot add dependency reload job for unit %s, ignoring: %s", dep->meta.id, bus_error(e, r));
+
+ if (e)
+ dbus_error_free(e);
+ }
+ }
+ }
+
/* JOB_VERIFY_STARTED, JOB_RELOAD require no dependency handling */
}
diff --git a/src/unit.c b/src/unit.c
index 3b476a8..e07d2c1 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -1539,7 +1539,9 @@ int unit_add_dependency(Unit *u, UnitDependency d, Unit *other, bool add_referen
[UNIT_REFERENCES] = UNIT_REFERENCED_BY,
[UNIT_REFERENCED_BY] = UNIT_REFERENCES,
[UNIT_TRIGGERS] = UNIT_TRIGGERED_BY,
- [UNIT_TRIGGERED_BY] = UNIT_TRIGGERS
+ [UNIT_TRIGGERED_BY] = UNIT_TRIGGERS,
+ [UNIT_PROPAGATE_RELOAD_TO] = UNIT_PROPAGATE_RELOAD_FROM,
+ [UNIT_PROPAGATE_RELOAD_FROM] = UNIT_PROPAGATE_RELOAD_TO
};
int r, q = 0, v = 0, w = 0;
@@ -2663,7 +2665,9 @@ static const char* const unit_dependency_table[_UNIT_DEPENDENCY_MAX] = {
[UNIT_REFERENCED_BY] = "ReferencedBy",
[UNIT_ON_FAILURE] = "OnFailure",
[UNIT_TRIGGERS] = "Triggers",
- [UNIT_TRIGGERED_BY] = "TriggeredBy"
+ [UNIT_TRIGGERED_BY] = "TriggeredBy",
+ [UNIT_PROPAGATE_RELOAD_TO] = "PropagateReloadTo",
+ [UNIT_PROPAGATE_RELOAD_FROM] = "PropagateReloadFrom"
};
DEFINE_STRING_TABLE_LOOKUP(unit_dependency, UnitDependency);
diff --git a/src/unit.h b/src/unit.h
index 4d83309..19314d6 100644
--- a/src/unit.h
+++ b/src/unit.h
@@ -124,6 +124,10 @@ enum UnitDependency {
UNIT_TRIGGERS,
UNIT_TRIGGERED_BY,
+ /* Propagate reloads */
+ UNIT_PROPAGATE_RELOAD_TO,
+ UNIT_PROPAGATE_RELOAD_FROM,
+
/* Reference information for GC logic */
UNIT_REFERENCES, /* Inverse of 'references' is 'referenced_by' */
UNIT_REFERENCED_BY,
commit bd1a69818042e85e24ec3adaf5eb3ac30ab1d9fd
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Jan 11 01:51:52 2012 +0100
shutdown: add link to root storage daemon text
diff --git a/src/shutdown.c b/src/shutdown.c
index 46b5aea..d157e0f 100644
--- a/src/shutdown.c
+++ b/src/shutdown.c
@@ -81,7 +81,9 @@ static bool ignore_proc(pid_t pid) {
return true;
/* Processes with argv[0][0] = '@' we ignore from the killing
- * spree. */
+ * spree.
+ *
+ * http://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons */
if (count == 1 && c == '@')
return true;
commit 8f53a7b8ea9ba505f8fefe4df4aaa5a8aab1e2eb
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Jan 11 01:51:32 2012 +0100
service: brutally slaughter processes that are running in the cgroup when we enter START_PRE and START
diff --git a/src/cgroup.c b/src/cgroup.c
index 4bbb54f..9680cd6 100644
--- a/src/cgroup.c
+++ b/src/cgroup.c
@@ -197,6 +197,9 @@ int cgroup_bonding_kill_list(CGroupBonding *first, int sig, bool sigcont, Set *s
Set *allocated_set = NULL;
int ret = -EAGAIN, r;
+ if (!first)
+ return 0;
+
if (!s)
if (!(s = allocated_set = set_new(trivial_hash_func, trivial_compare_func)))
return -ENOMEM;
diff --git a/src/service.c b/src/service.c
index 0110c9f..113be34 100644
--- a/src/service.c
+++ b/src/service.c
@@ -2021,6 +2021,11 @@ static void service_enter_start(Service *s) {
else
service_unwatch_main_pid(s);
+ /* We want to ensure that nobody leaks processes from
+ * START_PRE here, so let's go on a killing spree, People
+ * should not spawn long running processes from START_PRE. */
+ cgroup_bonding_kill_list(s->meta.cgroup_bondings, SIGKILL, true, NULL);
+
if (s->type == SERVICE_FORKING) {
s->control_command_id = SERVICE_EXEC_START;
c = s->control_command = s->exec_command[SERVICE_EXEC_START];
@@ -2090,6 +2095,11 @@ static void service_enter_start_pre(Service *s) {
service_unwatch_control_pid(s);
if ((s->control_command = s->exec_command[SERVICE_EXEC_START_PRE])) {
+
+ /* Before we start anything, let's clear up what might
+ * be left from previous runs. */
+ cgroup_bonding_kill_list(s->meta.cgroup_bondings, SIGKILL, true, NULL);
+
s->control_command_id = SERVICE_EXEC_START_PRE;
if ((r = service_spawn(s,
More information about the systemd-commits
mailing list