pidfd: implement PIDFD_THREAD flag for pidfd_open()
[sfrench/cifs-2.6.git] / fs / exec.c
index 8cdd5b2dd09c2e8047d6bd360e14b060dd23fbf0..b68f61bbcaa82e9adcb6ae7b2096ce1c9cf1ce3a 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1143,7 +1143,11 @@ static int de_thread(struct task_struct *tsk)
 
                BUG_ON(leader->exit_state != EXIT_ZOMBIE);
                leader->exit_state = EXIT_DEAD;
-
+               /*
+                * leader and tsk exhanged their pids, the old pid dies,
+                * wake up the PIDFD_THREAD waiters.
+                */
+               do_notify_pidfd(leader);
                /*
                 * We are going to release_task()->ptrace_unlink() silently,
                 * the tracer can sleep in do_wait(). EXIT_DEAD guarantees