wait4(): do not return ECHILD when child exists but not in PS_ZOMBIE state yet
This commit is contained in:
committed by
Balazs Gerofi bgerofi@riken.jp
parent
efc817de92
commit
0de6a30426
@@ -326,10 +326,8 @@ rescan:
|
||||
|
||||
ihk_mc_spinlock_lock_noirq(&child_iter->lock);
|
||||
|
||||
if (child_iter->status == PS_ZOMBIE
|
||||
&& (pid == -1 || pid == child_iter->pid)) {
|
||||
if (pid == -1 || pid == child_iter->pid) {
|
||||
child = child_iter;
|
||||
ihk_mc_spinlock_unlock_noirq(&child_iter->lock);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -341,9 +339,12 @@ rescan:
|
||||
return -ECHILD;
|
||||
}
|
||||
|
||||
/* If child is valid we are still holding its ftn->lock */
|
||||
if (child) {
|
||||
if (child->status == PS_ZOMBIE) {
|
||||
struct syscall_request request IHK_DMA_ALIGN;
|
||||
|
||||
ihk_mc_spinlock_unlock_noirq(&child->lock);
|
||||
dkprintf("wait: found PS_ZOMBIE process: %d\n", child->pid);
|
||||
|
||||
list_del(&child->siblings_list);
|
||||
@@ -368,6 +369,9 @@ rescan:
|
||||
goto exit;
|
||||
}
|
||||
|
||||
ihk_mc_spinlock_unlock_noirq(&child->lock);
|
||||
}
|
||||
|
||||
/* Don't sleep if WNOHANG requested */
|
||||
if (options & WNOHANG) {
|
||||
ihk_mc_spinlock_unlock_noirq(&proc->ftn->lock);
|
||||
|
||||
Reference in New Issue
Block a user