Skip to contentSkip to conversation

kernel: pid: Update Documentation

PATCH New Gargi Sharma 1 participant 1 message Mar 26, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel: pid: Update Documentation

In the free_pid() function, it is not intuitive why the reaper needs to be called if number of pids in the namespace are 2. Update the documentation based on the discussion here:
https://patchwork.kernel.org/patch/2851700/

---
 kernel/pid.c | 7 +++++++
 1 file changed, 7 insertions(+)
kernel/pid.c +7 -0
index 5822142..8fc5b9e 100644
@@ -268,6 +268,13 @@ void free_pid(struct pid *pid)
 		hlist_del_rcu(&upid->pid_chain);
 		switch (--ns->nr_hashed) {
 		case 2:
+			/*
+			 * It’s possible to get into a situation where a
+			 * pid->ns reaper is <defunct>, re-parented to host
+			 * pid 1, but never reaped. Wake up the reaper even
+			 * when nr_hashed hits 2, to prevent running a
+			 * container whose init is Process.exit(0)
+			 */
 		case 1:
 			/* When all that is left in the pid namespace
 			 * is the reaper wake up the reaper.  The reaper
Signature · 1 line
2.7.4