From: David Smith Date: Tue, 8 Jul 2014 20:14:38 +0000 (-0500) Subject: Fix PR17127 by fixing task_finder2. X-Git-Tag: release-2.6~91^2~27 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=386e80cf96d8b4b06636d9995d6e5174725f1274;p=systemtap.git Fix PR17127 by fixing task_finder2. * runtime/linux/task_finder2.c (stap_task_finder_post_init): Only try to interrupt tasks in the TASK_INTERRUPTIBLE state. --- diff --git a/runtime/linux/task_finder2.c b/runtime/linux/task_finder2.c index e88543a81..f6dd9a52c 100644 --- a/runtime/linux/task_finder2.c +++ b/runtime/linux/task_finder2.c @@ -1801,17 +1801,23 @@ stap_task_finder_post_init(void) UTRACE_ATTACH_MATCH_OPS, &tgt->ops, tgt); if (engine != NULL && !IS_ERR(engine)) { - /* We found a target task. Stop it. */ - int rc = utrace_control(tsk, engine, - UTRACE_INTERRUPT); - /* If utrace_control() returns - * EINPROGRESS when we're trying to - * stop/interrupt, that means the task - * hasn't stopped quite yet, but will - * soon. Ignore this error. */ - if (rc != 0 && rc != -EINPROGRESS) { - _stp_error("utrace_control returned error %d on pid %d", - rc, (int)tsk->pid); + /* Only try to interrupt tasks in the + * TASK_INTERRUPTIBLE state. */ + if (tsk->state == TASK_INTERRUPTIBLE) { + /* We found a target task. Stop it. */ + int rc = utrace_control(tsk, engine, + UTRACE_INTERRUPT); + /* If utrace_control() returns + * EINPROGRESS when we're + * trying to stop/interrupt, + * that means the task hasn't + * stopped quite yet, but will + * soon. Ignore this + * error. */ + if (rc != 0 && rc != -EINPROGRESS) { + _stp_error("utrace_control returned error %d on pid %d", + rc, (int)tsk->pid); + } } utrace_engine_put(engine);