[CRIU] [PATCH v3 15/33] ns: Set pointer to root_user_ns in ns_ids
Kirill Tkhai
ktkhai at virtuozzo.com
Thu Feb 16 04:08:50 PST 2017
Old type images do not have pointer to user_ns.
Set them manually.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
criu/namespaces.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/criu/namespaces.c b/criu/namespaces.c
index b3b79de24..0fafcfac7 100644
--- a/criu/namespaces.c
+++ b/criu/namespaces.c
@@ -1676,6 +1676,7 @@ static int do_read_old_user_ns_img(struct ns_id *ns, void *arg)
static int read_old_user_ns_img(void)
{
int ret, count = 0;
+ struct ns_id *ns;
if (!(root_ns_mask & CLONE_NEWUSER))
return 0;
@@ -1684,8 +1685,13 @@ static int read_old_user_ns_img(void)
return 0;
/* Old format img is only for root_user_ns. More or less is error */
ret = walk_namespaces(&user_ns_desc, do_read_old_user_ns_img, &count);
+ if (ret < 0)
+ return -1;
- return ret;
+ for (ns = ns_ids; ns != NULL; ns = ns->next)
+ if (ns->nd != &user_ns_desc)
+ ns->user_ns = root_user_ns;
+ return 0;
}
int prepare_userns(struct pstree_item *item)
More information about the CRIU
mailing list