[v2,03/57] user_ns: Keep root_user_ns ns fd in fdstore

Submitted by Kirill Tkhai on March 28, 2017, 3:34 p.m.

Details

Message ID 149071526150.12770.3476950768719348627.stgit@localhost.localdomain
State New
Series "Nested pid namespaces support"
Headers show

Commit Message

Kirill Tkhai March 28, 2017, 3:34 p.m.
This improves uniformity. Also, this will be used in next patch.

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

Patch hide | download patch | download mbox

diff --git a/criu/namespaces.c b/criu/namespaces.c
index 021cb020..20e67092 100644
--- a/criu/namespaces.c
+++ b/criu/namespaces.c
@@ -2203,16 +2203,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()) {