Commit 245fa6ea authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

mount: change cwd on the root before restoring mntns (v2)

We are going to make pivot_root after restoring mount name-space,
so relative paths will be used for mountpoints.

v2: print correct root in a error message
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 7e096fb1
......@@ -1275,10 +1275,6 @@ static int cr_pivot_root(struct mount_info *mis)
pr_info("Move the root to %s\n", opts.root);
if (chdir(opts.root)) {
pr_perror("chdir(%s) failed", opts.root);
return -1;
}
if (mkdtemp(put_root) == NULL) {
pr_perror("Can't create a temporary directory");
return -1;
......@@ -1472,6 +1468,11 @@ int prepare_mnt_ns(int ns_pid)
* prior to recreating new ones.
*/
if (chdir(opts.root ? : "/")) {
pr_perror("chdir(%s) failed", opts.root ? : "/");
return -1;
}
if (opts.root)
ret = cr_pivot_root(mis);
else
......
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