OpenVZ Forum

Home » Mailing lists » Devel » [PATCH 2/20] Move exit_task_namespaces()
[PATCH 2/20] Move exit_task_namespaces() [message #15721] Fri, 10 August 2007 11:47
Pavel Emelianov is currently offline  Pavel Emelianov
Messages: 1149
Registered: September 2006
Senior Member
Makve task release its namespaces after it has reparented all his children
to child_reaper, but before it notifies its parent about its death.

The reason to release namespaces after reparenting is that when task exits
it may send a signal to its parent (SIGCHLD), but if the parent has already
exited its namespaces there will be no way to decide what pid to dever to
him - parent can be from different namespace.

The reason to release namespace before notifying the parent it that when
task sends a SIGCHLD to parent it can call wait() on this taks and release
it. But releasing the mnt namespace implies dropping of all the mounts in
the mnt namespace and NFS expects the task to have valid sighand pointer.

Thanks to Oleg for pointing out some races that can apear and helping with
patches and fixes.

Signed-off-by: Pavel Emelyanov <>
Cc: Oleg Nesterov <>


 exit.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

--- ./kernel/exit.c.ve2	2007-07-27 12:45:46.000000000 +0400
+++ ./kernel/exit.c	2007-07-27 12:46:08.000000000 +0400
@@ -796,6 +796,7 @@ static void exit_notify(struct task_stru
 	 *	jobs, send them a SIGHUP and then a SIGCONT.  (POSIX
+	exit_task_namespaces(tsk);
@@ -1003,7 +1004,6 @@ fastcall NORET_TYPE void do_exit(long co
 	tsk->exit_code = code;
-	exit_task_namespaces(tsk);
Previous Topic: [PATCH 1/20] Reowrk forget_original_parent()
Next Topic: [PATCH 4/20] Prepare proc_flust_task() to flush entries from multiple proc trees
Goto Forum:

Current Time: Sun Jul 21 04:04:58 GMT 2024

Total time taken to generate the page: 0.02289 seconds