]> sourceware.org Git - systemtap.git/commitdiff
Better handle task_work_add() return values.
authorDavid Smith <dsmith@redhat.com>
Thu, 31 May 2012 21:28:45 +0000 (16:28 -0500)
committerDavid Smith <dsmith@redhat.com>
Thu, 31 May 2012 21:28:45 +0000 (16:28 -0500)
* runtime/stp_utrace.c (finish_report): Ignore ESRCH errors returned from
  task_work_add().
* runtime/task_finder2.c (__stp_utrace_task_finder_target_quiesce): Don't
  treat task_work_add() success as an error.
  (__stp_utrace_task_finder_target_syscall_exit): Ditto.

runtime/stp_utrace.c
runtime/task_finder2.c

index 62e8c7f688adad0582f8a3df09f9f1967dfbc1df..bac586824028fe7852b81893ef8c46e562a4ea5d 100644 (file)
@@ -1605,12 +1605,16 @@ static void finish_report(struct task_struct *task, struct utrace *utrace,
                utrace->resume = resume;
                if (! utrace->task_work_added) {
                        int rc = task_work_add(task, &utrace->work, true);
-                       if (rc != 0)
+                       if (rc == 0) {
+                               utrace->task_work_added = 1;
+                       }
+                       /* task_work_add() returns -ESRCH if the task
+                        * has already passed exit_task_work(). Just
+                        * ignore this error. */
+                       else if (rc != -ESRCH) {
                                printk(KERN_ERR
                                       "%s:%d - task_work_add() returned %d\n",
                                       __FUNCTION__, __LINE__, rc);
-                       else {
-                               utrace->task_work_added = 1;
                        }
                }
                spin_unlock(&utrace->lock);
index 7b1f892f5112211e42755998dc4216c7c7f844d2..19cb99e347099fb302d5ba97d3d6e6858f1d67b3 100644 (file)
@@ -1292,7 +1292,7 @@ __stp_utrace_task_finder_target_quiesce(u32 action,
                /* task_work_add() returns -ESRCH if the task has
                 * already passed exit_task_work(). Just ignore this
                 * error. */
-               if (rc != -ESRCH) {
+               if (rc != 0 && rc != -ESRCH) {
                        printk(KERN_ERR "%s:%d - task_work_add() returned %d\n",
                               __FUNCTION__, __LINE__, rc);
                }
@@ -1496,7 +1496,7 @@ __stp_utrace_task_finder_target_syscall_exit(u32 action,
                /* task_work_add() returns -ESRCH if the task has
                 * already passed exit_task_work(). Just ignore this
                 * error. */
-               if (rc != -ESRCH) {
+               if (rc != 0 && rc != -ESRCH) {
                        printk(KERN_ERR "%s:%d - task_work_add() returned %d\n",
                               __FUNCTION__, __LINE__, rc);
                }
This page took 0.034066 seconds and 5 git commands to generate.