Commit dcd68072 authored by Pavel Emelyanov's avatar Pavel Emelyanov

mount: Read mount images eary

We'll have to pre-mount some, so move the read_mnt_ns_img
before pivot_root call.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 70eb3cc4
...@@ -1286,14 +1286,12 @@ err: ...@@ -1286,14 +1286,12 @@ err:
return NULL; return NULL;
} }
static int populate_mnt_ns(int ns_pid) static int populate_mnt_ns(int ns_pid, struct mount_info *mis)
{ {
struct mount_info *pms; struct mount_info *pms;
mntinfo_tree = NULL; mntinfo_tree = NULL;
mntinfo = read_mnt_ns_img(ns_pid); mntinfo = mis;
if (mntinfo == NULL)
return -1;
pms = mnt_build_tree(mntinfo); pms = mnt_build_tree(mntinfo);
if (!pms) if (!pms)
...@@ -1308,12 +1306,17 @@ static int populate_mnt_ns(int ns_pid) ...@@ -1308,12 +1306,17 @@ static int populate_mnt_ns(int ns_pid)
int prepare_mnt_ns(int ns_pid) int prepare_mnt_ns(int ns_pid)
{ {
int ret; int ret = -1;
struct mount_info *mis;
pr_info("Restoring mount namespace\n"); pr_info("Restoring mount namespace\n");
close_proc(); close_proc();
mis = read_mnt_ns_img(ns_pid);
if (!mis)
goto out;
/* /*
* The new mount namespace is filled with the mountpoint * The new mount namespace is filled with the mountpoint
* clones from the original one. We have to umount them * clones from the original one. We have to umount them
...@@ -1328,8 +1331,8 @@ int prepare_mnt_ns(int ns_pid) ...@@ -1328,8 +1331,8 @@ int prepare_mnt_ns(int ns_pid)
free_mounts(); free_mounts();
if (!ret) if (!ret)
ret = populate_mnt_ns(ns_pid); ret = populate_mnt_ns(ns_pid, mis);
out:
return ret; return ret;
} }
......
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