systemd/0011-units-fix-BindsTo-logic-when-applied-relative-to-ser.patch
Stephan Kulow 8d0e9d5913 Accepting request 246497 from Base:System
- Add upstream patches for hwdb
  0001-hwdb-keymaps-for-Samsung-900X3E-900X3F.patch
  0002-Add-hwdb-entry-for-Samsung-Series-7-Ultra.patch
  0003-keymap-Fix-HP-Pavillon-DV7.patch
  0004-hwdb-update-format-description-and-document-reloadin.patch
  0008-hwdb-update.patch

- Port back and add the missed upstream patches from 2014/08/22
  0004-login-set_controller-should-fail-if-prepare_vt-fails.patch
  0006-login-share-VT-signal-handler-between-sessions.patch

- Add upstream patches
  0001-nspawn-fix-truncation-of-machine-names-in-interface-.patch
  0002-switch-root-umount-the-old-root-correctly.patch
  0003-bootchart-it-s-not-OK-to-return-1-from-a-main-progra.patch
  0005-sd-resolve-fix-allocation-if-query-ids-never-reuse-t.patch
  0007-journald-also-increase-the-SendBuffer-of-dev-log-to-.patch
  0008-mount-setup-fix-counting-of-early-mounts-without-SMA.patch
  0009-journald-Fix-off-by-one-error-in-Missed-X-kernel-mes.patch
  0010-machine_kill-Don-t-kill-the-unit-when-killing-the-le.patch
  0011-units-fix-BindsTo-logic-when-applied-relative-to-ser.patch
  0012-util-try-to-be-a-bit-more-NFS-compatible-when-checki.patch
  1063-udev-path_id-suppress-ID_PATH-for-devices-with-an-un.patch

- man pages from section 3 are developer docs, move them to 
 the -devel package.

- Add patch 0001-let-systemctl-completion-ignore-at-names.patch to
  remove error messages for tab completion for systemctl isolate (bnc#892162)

OBS-URL: https://build.opensuse.org/request/show/246497
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=200
2014-08-27 14:53:07 +00:00

94 lines
3.2 KiB
Diff

From ff50244582bf69e8489bba6ce59a21663d7f8274 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 18 Aug 2014 22:21:42 +0200
Subject: [PATCH] units: fix BindsTo= logic when applied relative to services
with Type=oneshot
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Start jobs for Type=oneshot units are successful when the unit state
transition activating → inactive took place. In such a case all units
that BindsTo= on it previously would continue to run, even though the unit
they dependet on was actually already gone.
---
src/core/unit.c | 48 ++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 44 insertions(+), 4 deletions(-)
diff --git src/core/unit.c src/core/unit.c
index a5f6b2e..950b83a 100644
--- src/core/unit.c
+++ src/core/unit.c
@@ -1471,12 +1471,44 @@ static void unit_check_unneeded(Unit *u) {
if (unit_active_or_pending(other))
return;
- log_info_unit(u->id, "Service %s is not needed anymore. Stopping.", u->id);
+ log_info_unit(u->id, "Unit %s is not needed anymore. Stopping.", u->id);
/* Ok, nobody needs us anymore. Sniff. Then let's commit suicide */
manager_add_job(u->manager, JOB_STOP, u, JOB_FAIL, true, NULL, NULL);
}
+static void unit_check_binds_to(Unit *u) {
+ bool stop = false;
+ Unit *other;
+ Iterator i;
+
+ assert(u);
+
+ if (u->job)
+ return;
+
+ if (unit_active_state(u) != UNIT_ACTIVE)
+ return;
+
+ SET_FOREACH(other, u->dependencies[UNIT_BINDS_TO], i) {
+ if (other->job)
+ continue;
+
+ if (!UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(other)))
+ continue;
+
+ stop = true;
+ }
+
+ if (!stop)
+ return;
+
+ log_info_unit(u->id, "Unit %s is bound to inactive service. Stopping, too.", u->id);
+
+ /* A unit we need to run is gone. Sniff. Let's stop this. */
+ manager_add_job(u->manager, JOB_STOP, u, JOB_FAIL, true, NULL, NULL);
+}
+
static void retroactively_start_dependencies(Unit *u) {
Iterator i;
Unit *other;
@@ -1788,11 +1820,19 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
manager_recheck_journal(m);
unit_trigger_notify(u);
- /* Maybe we finished startup and are now ready for being
- * stopped because unneeded? */
- if (u->manager->n_reloading <= 0)
+ if (u->manager->n_reloading <= 0) {
+ /* Maybe we finished startup and are now ready for
+ * being stopped because unneeded? */
unit_check_unneeded(u);
+ /* Maybe we finished startup, but something we needed
+ * has vanished? Let's die then. (This happens when
+ * something BindsTo= to a Type=oneshot unit, as these
+ * units go directly from starting to inactive,
+ * without ever entering started.) */
+ unit_check_binds_to(u);
+ }
+
unit_add_to_dbus_queue(u);
unit_add_to_gc_queue(u);
}
--
1.7.9.2