_stp_target = st->target;
st->res = systemtap_module_init();
- if (st->res == 0)
+ if (st->res == 0) {
_stp_probes_started = 1;
- /* Register the module notifier. */
- if (!_stp_module_notifier_active) {
- int rc = register_module_notifier(& _stp_module_notifier_nb);
- if (rc == 0)
- _stp_module_notifier_active = 1;
- else
- _stp_warn ("Cannot register module notifier (%d)\n", rc);
+ /* Register the module notifier ... */
+ /* NB: but not if the module_init stuff
+ failed: something nasty has happened, and
+ we want no further probing started. PR16766 */
+ if (!_stp_module_notifier_active) {
+ int rc = register_module_notifier(& _stp_module_notifier_nb);
+ if (rc == 0)
+ _stp_module_notifier_active = 1;
+ else
+ _stp_warn ("Cannot register module notifier (%d)\n", rc);
+ }
}
/* Called from the user context in response to a proc
{
o->newline() << "static void systemtap_module_refresh (void) {";
o->newline(1) << "int i=0, j=0;"; // for derived_probe_group use
+
+ /* If we're not in STARTING/RUNNING state, don't try doing any work.
+ PR16766 */
+ o->newline() << "int state = atomic_read (session_state());";
+ o->newline() << "if (state != STAP_SESSION_RUNNING && state != STAP_SESSION_STARTING) {";
+ // cannot _stp_warn etc. since we're not in probe context
+ o->newline(1) << "printk (KERN_ERR \"stap module notifier triggered in unexpected state %d\", state);";
+ o->newline() << "return;";
+ o->newline(-1) << "}";
+
o->newline() << "(void) i;";
o->newline() << "(void) j;";
+
vector<derived_probe_group*> g = all_session_groups (*session);
for (unsigned i=0; i<g.size(); i++)
{