On 02/26, Oleg Nesterov wrote:
>
> On 02/26, Oleg Nesterov wrote:
> >
> > Now that I look at this code again... Why do we bother to check
> > "pid_allocated & PIDNS_ADDING" at all? copy_process() does
> >
> >     /* Don't start children in a dying pid namespace */
> >     if (unlikely(!(ns_of_pid(pid)->pid_allocated & PIDNS_ADDING))) {
> >             retval = -ENOMEM;
> >             goto bad_fork_core_free;
> >     }
> >
> > I am going to send the patch which removes this check from alloc_pid...
> > Need to recheck.
>
> No, we can't remove either of these 2 checks...
>
> This probably deserves another comment in alloc_pid().

something like

        We need this even if copy_process() does the same check. If two
        or more tasks from parent namespace try to inject a child into a
        dead namespace, one of free_pid() calls from the copy_process()
        error path may try to wakeup the possibly freed ns->child_reaper.

perhaps? does it look clear enough?

Oleg.


Reply via email to