Print this page
7267 SMF is fast and loose with optional dependencies
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Albert Lee <trisk@omniti.com>
Reviewed by: Gordon Ross <gordon.w.ross@gmail.com>

@@ -19,10 +19,12 @@
  * CDDL HEADER END
  */
 /*
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright 2016 RackTop Systems.
  */
 
 
 /*
  * transition.c - Graph State Machine

@@ -135,10 +137,17 @@
 
                 log_framework(LOG_DEBUG, "Propagating maintenance (stop) of "
                     "%s.\n", v->gv_name);
 
                 graph_transition_propagate(v, PROPAGATE_STOP, rerr);
+
+                /*
+                 * The maintenance transition may satisfy optional_all/restart
+                 * dependencies and should be propagated to determine
+                 * whether new dependents are satisfiable.
+                 */
+                graph_transition_propagate(v, PROPAGATE_SAT, rerr);
         } else {
                 log_framework(LOG_DEBUG, "Propagating maintenance of %s.\n",
                     v->gv_name);
 
                 graph_transition_propagate(v, PROPAGATE_SAT, rerr);

@@ -152,10 +161,11 @@
 static int
 gt_enter_offline(scf_handle_t *h, graph_vertex_t *v,
     restarter_instance_state_t old_state, restarter_error_t rerr)
 {
         int to_offline = v->gv_flags & GV_TOOFFLINE;
+        int to_disable = v->gv_flags & GV_TODISABLE;
 
         v->gv_flags &= ~GV_TOOFFLINE;
 
         /*
          * If the instance should be enabled, see if we can start it.

@@ -162,11 +172,11 @@
          * Otherwise send a disable command.
          * If a instance has the GV_TOOFFLINE flag set then it must
          * remains offline until the disable process completes.
          */
         if (v->gv_flags & GV_ENABLED) {
-                if (to_offline == 0)
+                if (to_offline == 0 && to_disable == 0)
                         graph_start_if_satisfied(v);
         } else {
                 if (gt_running(old_state) && v->gv_post_disable_f)
                         v->gv_post_disable_f();
 

@@ -265,10 +275,16 @@
                 log_framework(LOG_DEBUG, "Propagating stop of %s.\n",
                     v->gv_name);
 
                 graph_transition_propagate(v, PROPAGATE_STOP, rerr);
 
+                /*
+                 * The disable transition may satisfy optional_all/restart
+                 * dependencies and should be propagated to determine
+                 * whether new dependents are satisfiable.
+                 */
+                graph_transition_propagate(v, PROPAGATE_SAT, rerr);
         } else {
                 log_framework(LOG_DEBUG, "Propagating disable of %s.\n",
                     v->gv_name);
 
                 graph_transition_propagate(v, PROPAGATE_SAT, rerr);