Commit d5e6a51b authored by Pavel Emelyanov's avatar Pavel Emelyanov

Revert "mnt: Merge two calls to collect_mntinfo on early restore"

This reverts commit f55a0b91.

The collected mounts list a) points to nsid and b) should be
put on nsid's mntinfo_tree. Thus is _should_ be done by separate
calls.
parent 1435617c
...@@ -1419,7 +1419,7 @@ static int create_mnt_roots(void) ...@@ -1419,7 +1419,7 @@ static int create_mnt_roots(void)
return 0; return 0;
} }
static int rst_collect_local_mntns(struct mount_info *mi) static int rst_collect_local_mntns(void)
{ {
struct ns_id *nsid; struct ns_id *nsid;
...@@ -1432,11 +1432,14 @@ static int rst_collect_local_mntns(struct mount_info *mi) ...@@ -1432,11 +1432,14 @@ static int rst_collect_local_mntns(struct mount_info *mi)
nsid->pid = getpid(); nsid->pid = getpid();
futex_set(&nsid->created, 1); futex_set(&nsid->created, 1);
mntinfo = mi; mntinfo = collect_mntinfo(nsid);
if (mntinfo == NULL)
return -1;
nsid->next = ns_ids; nsid->next = ns_ids;
ns_ids = nsid; ns_ids = nsid;
pr_info("Add local mntns %d pid %d\n", nsid->id, nsid->pid); pr_info("Add namespace %d pid %d\n", nsid->id, nsid->pid);
return 0; return 0;
} }
...@@ -1725,15 +1728,15 @@ int prepare_mnt_ns(void) ...@@ -1725,15 +1728,15 @@ int prepare_mnt_ns(void)
struct mount_info *mis, *old; struct mount_info *mis, *old;
struct ns_id ns = { .pid = getpid(), .nd = &mnt_ns_desc }; struct ns_id ns = { .pid = getpid(), .nd = &mnt_ns_desc };
old = collect_mntinfo(&ns);
if (old == NULL)
return -1;
if (!(root_ns_mask & CLONE_NEWNS)) if (!(root_ns_mask & CLONE_NEWNS))
return rst_collect_local_mntns(old); return rst_collect_local_mntns();
pr_info("Restoring mount namespace\n"); pr_info("Restoring mount namespace\n");
old = collect_mntinfo(&ns);
if (old == NULL)
return -1;
close_proc(); close_proc();
mis = read_mnt_ns_img(); mis = read_mnt_ns_img();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment