[PATCH 1/2] utrace: utrace_reset: use ->stopped instead of !action

Oleg Nesterov oleg at redhat.com
Wed Aug 26 13:02:04 UTC 2009


(on top of "[PATCH v2] utrace: fix utrace_stop()->utrace_reset() path")

The callers of utrace_reset() should be careful with action argument,
it affects the wakeup logic. Imho this is a bit fragile and uncler.
Change utrace_reset to use ->stopped instead.

This way "if (wake)" is always right, regardless of action != NULL,
and very understandable. It can't provoke a false wakeup, and it
can't miss the wakeup if it is needed.

If ->stopped == F, obviously wakeup is not needed, even if the tracee
is TASK_STOPPED.

IF ->stopped == T, we must not leave the tracee without ENGINE_STOP
in TASK_TRACED once we drop utrace->lock.

Signed-off-by: Oleg Nesterov <oleg at redhat.com>

--- __UTRACE/kernel/utrace.c~3_RESUME_WAKE	2009-08-26 14:19:01.000000000 +0200
+++ __UTRACE/kernel/utrace.c	2009-08-26 14:22:58.000000000 +0200
@@ -730,7 +730,7 @@ static void utrace_reset(struct task_str
 	struct utrace_engine *engine, *next;
 	unsigned long flags = 0;
 	LIST_HEAD(detached);
-	bool wake = !action;
+	bool wake = utrace->stopped;
 
 	splice_attaching(utrace);
 




More information about the utrace-devel mailing list