#define debug_task_finder_attach() (atomic_inc(&__stp_attach_count))
#define debug_task_finder_detach() (atomic_dec(&__stp_attach_count))
+#ifdef DEBUG_TASK_FINDER_PRINTK
+#define debug_task_finder_report() (printk(KERN_ERR \
+ "%s:%d attach count: %d, inuse count: %d\n", \
+ __FUNCTION__, __LINE__, \
+ atomic_read(&__stp_attach_count), \
+ atomic_read(&__stp_inuse_count)))
+#else
#define debug_task_finder_report() (_stp_dbug(__FUNCTION__, __LINE__, \
"attach count: %d, inuse count: %d\n", \
atomic_read(&__stp_attach_count), \
atomic_read(&__stp_inuse_count)))
+#endif /* !DEBUG_TASK_FINDER_PRINTK */
#else
#define debug_task_finder_attach() /* empty */
#define debug_task_finder_detach() /* empty */
#define debug_task_finder_report() /* empty */
-#endif
+#endif /* !DEBUG_TASK_FINDER */
typedef int (*stap_task_finder_callback)(struct stap_task_finder_target *tgt,
struct task_struct *tsk,
break;
case -ESRCH: /* REAP callback already begun */
case -EALREADY: /* DEATH callback already begun */
- rc = 0; /* ignore these errors*/
+ rc = 0; /* ignore these errors */
+ break;
+ case -EINPROGRESS:
+ debug_task_finder_detach();
+ rc = 0;
break;
default:
rc = -rc;
- _stp_error("utrace_detach returned error %d on pid %d",
+ _stp_error("utrace_control returned error %d on pid %d",
rc, tsk->pid);
break;
}
{
struct task_struct *grp, *tsk;
struct utrace_attached_engine *engine;
- int rc = 0;
pid_t pid = 0;
// Notice we're not calling get_task_mm() in this loop. In
continue;
#endif
- rc = stap_utrace_detach(tsk, ops);
- if (rc != 0)
- goto udo_err;
+ /* Notice we're purposefully ignoring errors from
+ * stap_utrace_detach(). Even if we got an error on
+ * this task, we need to keep detaching from other
+ * tasks. */
+ (void) stap_utrace_detach(tsk, ops);
} while_each_thread(grp, tsk);
-udo_err:
rcu_read_unlock();
debug_task_finder_report();
}
* ref.
*/
rc = utrace_barrier(tsk, engine);
- if (rc != 0)
+ if (rc != -ESRCH && rc != -EALREADY)
_stp_error("utrace_barrier returned error %d on pid %d",
rc, (int)tsk->pid);
}
}
}
- else
+ else if (rc != -ESRCH && rc != -EALREADY)
_stp_error("utrace_set_events2 returned error %d on pid %d",
rc, (int)tsk->pid);
utrace_engine_put(engine);
* a stale task pointer, if we have an engine ref.
*/
rc = utrace_barrier(tsk, engine);
- if (rc != 0)
+ if (rc == 0)
+ rc = utrace_set_events(tsk, engine,
+ __STP_ATTACHED_TASK_BASE_EVENTS(tgt));
+ else if (rc != -ESRCH && rc != -EALREADY)
_stp_error("utrace_barrier returned error %d on pid %d",
rc, (int)tsk->pid);
- rc = utrace_set_events(tsk, engine,
- __STP_ATTACHED_TASK_BASE_EVENTS(tgt));
}
if (rc != 0)
_stp_error("utrace_set_events returned error %d on pid %d",