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);
|
ihk_mc_spinlock_lock_noirq(&child_iter->lock);
|
||||||
|
|
||||||
if (child_iter->status == PS_ZOMBIE
|
if (pid == -1 || pid == child_iter->pid) {
|
||||||
&& (pid == -1 || pid == child_iter->pid)) {
|
|
||||||
child = child_iter;
|
child = child_iter;
|
||||||
ihk_mc_spinlock_unlock_noirq(&child_iter->lock);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,9 +339,12 @@ rescan:
|
|||||||
return -ECHILD;
|
return -ECHILD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If child is valid we are still holding its ftn->lock */
|
||||||
if (child) {
|
if (child) {
|
||||||
|
if (child->status == PS_ZOMBIE) {
|
||||||
struct syscall_request request IHK_DMA_ALIGN;
|
struct syscall_request request IHK_DMA_ALIGN;
|
||||||
|
|
||||||
|
ihk_mc_spinlock_unlock_noirq(&child->lock);
|
||||||
dkprintf("wait: found PS_ZOMBIE process: %d\n", child->pid);
|
dkprintf("wait: found PS_ZOMBIE process: %d\n", child->pid);
|
||||||
|
|
||||||
list_del(&child->siblings_list);
|
list_del(&child->siblings_list);
|
||||||
@@ -368,6 +369,9 @@ rescan:
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ihk_mc_spinlock_unlock_noirq(&child->lock);
|
||||||
|
}
|
||||||
|
|
||||||
/* Don't sleep if WNOHANG requested */
|
/* Don't sleep if WNOHANG requested */
|
||||||
if (options & WNOHANG) {
|
if (options & WNOHANG) {
|
||||||
ihk_mc_spinlock_unlock_noirq(&proc->ftn->lock);
|
ihk_mc_spinlock_unlock_noirq(&proc->ftn->lock);
|
||||||
|
|||||||
Reference in New Issue
Block a user