Browse Source

Fix dependency-ordered stop of services

Hard dependents might not be holding the dependee active if they are
stopping, so when checking dependents, don't rely on holding_acq flag as
an indicator that dependent has stopped.
Davin McCall 1 year ago
parent
commit
2ee11970c6
1 changed files with 2 additions and 7 deletions
  1. 2 7
      src/service.cc

+ 2 - 7
src/service.cc

@@ -686,9 +686,6 @@ bool service_record::stop_dependents(bool for_restart, bool restart_deps) noexce
     // We are in either STARTED or STARTING states.
     bool all_deps_stopped = true;
     for (auto dept : dependents) {
-        if (!dept->holding_acq) {
-            continue;
-        }
         if (dept->is_hard()) {
             service_record *dep_from = dept->get_from();
 
@@ -729,17 +726,15 @@ bool service_record::stop_dependents(bool for_restart, bool restart_deps) noexce
         }
         // Note that soft dependencies are retained if restarting, but otherwise
         // they are broken.
-        else if (!for_restart && !dept->is_hard()) {
+        else if (!for_restart) {
             if (dept->waiting_on) {
                 // Note, milestone which is still waiting is considered a hard dependency and
                 // is handled above. This is therefore a true soft dependency, and we can just
                 // break the dependency link.
                 dept->waiting_on = false;
                 dept->get_from()->dependency_started();
-                dept->holding_acq = false;
-                release(false);
             }
-            else {
+            if (dept->holding_acq) {
                 dept->holding_acq = false;
                 release(false);
             }