From 229b160acd4ef4e822e6bebf6026fe9423ba7ea9 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov Date: Wed, 23 Sep 2009 15:56:48 -0700 Subject: [PATCH] --- yaml --- r: 165676 b: refs/heads/master c: 5c01ba49e6647d86bc7576105f82027200d1f303 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/kernel/exit.c | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 2a9516be86d6..2aac6580edab 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b4fe51823d797d6959b2eee7868023e61606daa9 +refs/heads/master: 5c01ba49e6647d86bc7576105f82027200d1f303 diff --git a/trunk/kernel/exit.c b/trunk/kernel/exit.c index 270a68b7f22f..3fb9a77863d5 100644 --- a/trunk/kernel/exit.c +++ b/trunk/kernel/exit.c @@ -1111,13 +1111,16 @@ static struct pid *task_pid_type(struct task_struct *task, enum pid_type type) return pid; } -static int eligible_child(struct wait_opts *wo, struct task_struct *p) +static inline int eligible_pid(struct wait_opts *wo, struct task_struct *p) { - if (wo->wo_type < PIDTYPE_MAX) { - if (task_pid_type(p, wo->wo_type) != wo->wo_pid) - return 0; - } + return wo->wo_type == PIDTYPE_MAX || + task_pid_type(p, wo->wo_type) == wo->wo_pid; +} +static int eligible_child(struct wait_opts *wo, struct task_struct *p) +{ + if (!eligible_pid(wo, p)) + return 0; /* Wait for all children (clone and not) if __WALL is set; * otherwise, wait for clone children *only* if __WCLONE is * set; otherwise, wait for non-clone children *only*. (Note: @@ -1578,7 +1581,7 @@ static int child_wait_callback(wait_queue_t *wait, unsigned mode, child_wait); struct task_struct *p = key; - if (!eligible_child(wo, p)) + if (!eligible_pid(wo, p)) return 0; if ((wo->wo_flags & __WNOTHREAD) && wait->private != p->parent)