On Tue, Nov 09, 2004 at 08:11:41AM -0800, Linus Torvalds wrote: > > I think I have a potentially better approach: make the rules for "flag" a > bit more explicit, and make it have structure. We use "flag" for two > things: we use it to determine if we should return -ECHILD (no children), > and for whether we should wait for something that might become available > later. So just split up "flag" into these two meanings, instead of just > trying to use a single bit: > > - one bit that says "we found a child that _will_ wake us up when it's > ready". In other words, that's a child that is ours, and is not yet a > zombie. > > - one bit that says "we found a child that is ours". > > Make "eligible_child()" follow these rules, and then instead of just > setting "flag = 1", we'd set "flag |= ret". > > Now, with these rules, we know just what to do: we only do the wait if the > "we have children that will wake us up" bit is set. But we return ECHILD > only if flag is totally clear. > > Does that sound like it would fix the problem? > How about if we set the flag only in the cases when the exit state is not either TASK_DEAD or TASK_ZOMBIE. Patch attached below. I confirmed that this fixes the problem and I also ran some LTP tests Signed-off-by: Dinakar Guniguntala Signed-off-by: Sripathi Kodi