[CRIU] [PATCH v1 03/55] user_ns: Keep root_user_ns ns fd in fdstore

Kirill Tkhai ktkhai at virtuozzo.com
Fri Mar 24 07:55:47 PDT 2017


This improves uniformity. Also, this will be used in next patch.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/namespaces.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/criu/namespaces.c b/criu/namespaces.c
index b6780633..e4555251 100644
--- a/criu/namespaces.c
+++ b/criu/namespaces.c
@@ -2192,16 +2192,16 @@ static int create_user_ns_hierarhy_fn(void *in_arg)
 	if (p_arg->me != root_user_ns)
 		p_futex = &p_arg->futex;
 	me = p_arg->me;
+	me->user.nsfd_id = store_self_ns(me);
+	if (me->user.nsfd_id < 0) {
+		pr_err("Can't add fd to fdstore\n");
+		goto out;
+	}
 
 	if (p_futex) {
 		/* Set self pid to allow parent restore user_ns maps */
 		p_arg->pid = get_self_real_pid();
 		futex_set_and_wake(p_futex, NS__CREATED);
-		me->user.nsfd_id = store_self_ns(me);
-		if (me->user.nsfd_id < 0) {
-			pr_err("Can't add fd to fdstore\n");
-			goto out;
-		}
 
 		futex_wait_while_lt(p_futex, NS__MAPS_POPULATED);
 		if (prepare_userns_creds()) {



More information about the CRIU mailing list