Print this page
7246 SMF stops dependents in the wrong order
7267 SMF is fast and loose with optional dependencies

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/svc/startd/transition.c
          +++ new/usr/src/cmd/svc/startd/transition.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
       24 + *
       25 + * Copyright 2016 RackTop Systems.
  24   26   */
  25   27  
  26   28  
  27   29  /*
  28   30   * transition.c - Graph State Machine
  29   31   *
  30   32   * The graph state machine is implemented here, with a typical approach
  31   33   * of a function per state.  Separating the implementation allows more
  32   34   * clarity into the actions taken on notification of state change, as well
  33   35   * as a place for future expansion including hooks for configurable actions.
↓ open down ↓ 96 lines elided ↑ open up ↑
 130  132                          log_framework(LOG_DEBUG, "%s removed from subtree\n",
 131  133                              v->gv_name);
 132  134  
 133  135                          graph_offline_subtree_leaves(v, (void *)h);
 134  136                  }
 135  137  
 136  138                  log_framework(LOG_DEBUG, "Propagating maintenance (stop) of "
 137  139                      "%s.\n", v->gv_name);
 138  140  
 139  141                  graph_transition_propagate(v, PROPAGATE_STOP, rerr);
      142 +
      143 +                /*
      144 +                 * The maintenance transition may satisfy optional_all/restart
      145 +                 * dependencies and should be propagated to determine
      146 +                 * whether new dependents are satisfiable.
      147 +                 */
      148 +                graph_transition_propagate(v, PROPAGATE_SAT, rerr);
 140  149          } else {
 141  150                  log_framework(LOG_DEBUG, "Propagating maintenance of %s.\n",
 142  151                      v->gv_name);
 143  152  
 144  153                  graph_transition_propagate(v, PROPAGATE_SAT, rerr);
 145  154          }
 146  155  
 147  156          graph_transition_sulogin(RESTARTER_STATE_MAINT, old_state);
 148  157          return (0);
 149  158  }
↓ open down ↓ 110 lines elided ↑ open up ↑
 260  269                           */
 261  270                          graph_offline_subtree_leaves(v, (void *)h);
 262  271                  }
 263  272  
 264  273  
 265  274                  log_framework(LOG_DEBUG, "Propagating stop of %s.\n",
 266  275                      v->gv_name);
 267  276  
 268  277                  graph_transition_propagate(v, PROPAGATE_STOP, rerr);
 269  278  
      279 +                /*
      280 +                 * The disable transition may satisfy optional_all/restart
      281 +                 * dependencies and should be propagated to determine
      282 +                 * whether new dependents are satisfiable.
      283 +                 */
      284 +                graph_transition_propagate(v, PROPAGATE_SAT, rerr);
 270  285          } else {
 271  286                  log_framework(LOG_DEBUG, "Propagating disable of %s.\n",
 272  287                      v->gv_name);
 273  288  
 274  289                  graph_transition_propagate(v, PROPAGATE_SAT, rerr);
 275  290          }
 276  291  
 277  292          graph_transition_sulogin(RESTARTER_STATE_DISABLED, old_state);
 278  293          return (0);
 279  294  }
↓ open down ↓ 39 lines elided ↑ open up ↑
 319  334          }
 320  335  
 321  336          if (!(v->gv_flags & GV_ENABLED)) {
 322  337                  vertex_send_event(v, RESTARTER_EVENT_TYPE_DISABLE);
 323  338          } else if (v->gv_flags & GV_TOOFFLINE) {
 324  339                  /*
 325  340                   * If the vertex has the GV_TOOFFLINE flag set then that's
 326  341                   * because the instance was transitioning from offline to
 327  342                   * online and the reverse disable algorithm doesn't offline
 328  343                   * those instances because it was already appearing offline.
 329      -                 * So do it now.
      344 +                 * Try to do it now.
 330  345                   */
 331      -                offline_vertex(v);
      346 +                if (insubtree_dependents_down(v))
      347 +                        offline_vertex(v);
 332  348          }
 333  349  
 334  350          if (gt_running(old_state) == 0) {
 335  351                  log_framework(LOG_DEBUG, "Propagating start of %s.\n",
 336  352                      v->gv_name);
 337  353  
 338  354                  graph_transition_propagate(v, PROPAGATE_START, rerr);
 339  355          } else if (rerr == RERR_REFRESH) {
 340  356                  /* For refresh we'll get a message sans state change */
 341  357  
↓ open down ↓ 128 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX