9687 SMF service cannot be disabled

Review Request #497 — Created Aug. 1, 2018 and submitted

andy_js
illumos-gate
9687
f86c22f...
general

When a service or administrator requests that a service instance is disabled the GV_TOOFFLINE and GV_TODISABLE flags are set on it, and it is taken offline. When entering offline state GV_TOOFFLINE is cleared and if GV_TODISABLE is set, another request is sent to begin the transition into disabled state. Or at least this is what should happen. Currently the code checks GV_ENABLED instead, which sometimes means services are brought back online or fail to transition at all.

Most notably this is seen when a service is stuck in maintaince mode and doesn't transition to disabled until it is cleared.

Put service into stuck state by manipulating properties using svccfg. Prior to the fix, restarting svc.startd was not enough to force a transition into the correct state. After the fix, it was.

tsoome
  1. Ship It!
  2. 
      
domag02
  1. Ship it!

    Not for this issue:
    Is it worth to create some helper macros for handling gv_flags?
    Something like these:

    #define IS_GV_CONFIGURED(v) ((v)->gv_flags & GV_CONFIGURED)
    #define IS_GV_ENABLED(v)    ((v)->gv_flags & GV_ENABLED)
    #define IS_GV_ENBLD_NOOVR(v)    ((v)->gv_flags & GV_ENBLD_NOOVR)
    #define IS_GV_INSUBGRAPH(v) ((v)->gv_flags & GV_INSUBGRAPH)
    #define IS_GV_DEATHROW(v)   ((v)->gv_flags & GV_DEATHROW)
    #define IS_GV_TOOFFLINE(v)  ((v)->gv_flags & GV_TOOFFLINE)
    #define IS_GV_TODISABLE(v)  ((v)->gv_flags & GV_TODISABLE)
    
    #define SET_GV_CONFIGURED(v)    ((v)->gv_flags |= GV_CONFIGURED)
    #define SET_GV_ENABLED(v)   ((v)->gv_flags & GV_ENABLED)
    #define SET_GV_ENBLD_NOOVR(v)   ((v)->gv_flags & GV_ENBLD_NOOVR)
    #define SET_GV_INSUBGRAPH(v)    ((v)->gv_flags |= GV_INSUBGRAPH)
    #define SET_GV_DEATHROW(v)  ((v)->gv_flags |= GV_DEATHROW)
    #define SET_GV_TOOFFLINE(v) ((v)->gv_flags |= GV_TOOFFLINE)
    #define SET_GV_TODISABLE(v) ((v)->gv_flags |= GV_TODISABLE)
    
    #define CLEAR_GV_CONFIGURED(v)  ((v)->gv_flags &= ~GV_CONFIGURED)
    #define CLEAR_GV_INSUBGRAPH(v)  ((v)->gv_flags &= ~GV_INSUBGRAPH)
    #define CLEAR_GV_DEATHROW(v)    ((v)->gv_flags &= ~GV_DEATHROW)
    #define CLEAR_GV_TOOFFLINE(v)   ((v)->gv_flags &= ~GV_TOOFFLINE)
    #define CLEAR_GV_TODISABLE(v)   ((v)->gv_flags &= ~GV_TODISABLE)
    #define CLEAR_GV_FLAGS_ALL(v)   ((v)->gv_flags = 0)
    

    This could be in startd.h, for the benefit of using these in transition.c and graph.c.

    1. I'll add this to my todo list.

  2. 
      
andy_js
danmcd
  1. While the bug report's description is technically accurate, is there a way you can elaborate in it a bit? Maybe an example? Just so future readers can have some insight to the opaque SMF workings?

  2. 
      
tsoome
  1. Ship It!
  2. 
      
andy_js
andy_js
andy_js
domag02
  1. Ship It!
  2. 
      
andy_js
Review request changed

Status: Closed (submitted)

Loading...