Damn. I promise, this is the last patch today. Can't understand why
I can't relax. Most probably I am trying to avoid utrace-ptrace work
subconsciously...

On 09/09, Oleg Nesterov wrote:
>
> OTOH, if we change utrace_reap() to clear ->utrace_flags, then
> utrace_add_engine() do not need to check ->reap at all.

Yes, makes sense imho. (assuming that the optimization makes sense).

So, once again. This all is up to you, please feel free to ignore
or redo.

Signed-off-by: Oleg Nesterov <o...@redhat.com>
---

 kernel/utrace.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

--- __UTRACE/kernel/utrace.c~5_ATTACH_DONT_CK_REAP      2009-09-08 
23:46:10.000000000 +0200
+++ __UTRACE/kernel/utrace.c    2009-09-09 00:29:21.000000000 +0200
@@ -148,14 +148,11 @@ static int utrace_add_engine(struct task
             unlikely(matching_engine(utrace, flags, ops, data)))
                goto unlock;
 
-       ret = -ESRCH;
-       /* can't attach after utrace_release_task() */
-       if (utrace->reap)
-               goto unlock;
        /*
         * In case we had no engines before, make sure that
         * utrace_flags is not zero.
         */
+       ret = -ESRCH;
        if (!target->utrace_flags) {
                target->utrace_flags = UTRACE_EVENT(REAP);
                /*
@@ -414,8 +411,8 @@ static void utrace_reap(struct task_stru
 {
        struct utrace_engine *engine, *next;
 
-       BUG_ON(!utrace->reap);
-
+       /* utrace_add_engine() checks ->utrace_flags != 0 */
+       target->utrace_flags = 0;
        splice_attaching(utrace);
 
        /*

Reply via email to