Commit de4326a3 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

mount: return descriptor from mntns_collect_root

We are going to support nested mount namespaces, so files can be opened
from more than one namespace and a root must be collect for each file.
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 36a9f316
......@@ -536,7 +536,7 @@ int cr_check(void)
if (!is_root_user())
return -1;
if (mntns_collect_root(getpid())) {
if (mntns_collect_root(getpid()) < 0) {
pr_err("Can't collect root mount point\n");
return -1;
}
......
......@@ -1659,7 +1659,7 @@ int cr_pre_dump_tasks(pid_t pid)
if (collect_mount_info(pid))
goto err;
if (mntns_collect_root(root_item->pid.real))
if (mntns_collect_root(root_item->pid.real) < 0)
goto err;
for_each_pstree_item(item)
......@@ -1769,7 +1769,7 @@ int cr_dump_tasks(pid_t pid)
if (collect_mount_info(pid))
goto err;
if (mntns_collect_root(root_item->pid.real))
if (mntns_collect_root(root_item->pid.real) < 0)
goto err;
if (collect_sockets(pid))
......
......@@ -1254,7 +1254,7 @@ static int restore_task_with_children(void *_arg)
if (close_old_fds(current))
exit(1);
if (mntns_collect_root(getpid()))
if (mntns_collect_root(getpid()) < 0)
exit(1);
if (root_prepare_shared())
......
......@@ -836,7 +836,7 @@ int dump_mnt_ns(int ns_pid, int ns_id)
if (img_fd < 0)
return -1;
if (mntns_collect_root(ns_pid))
if (mntns_collect_root(ns_pid) < 0)
goto err;
pm = parse_mountinfo(ns_pid);
......@@ -1772,7 +1772,7 @@ int mntns_collect_root(pid_t pid)
set_root:
ret = install_service_fd(ROOT_FD_OFF, fd);
close(fd);
return ret < 0 ? -1 : 0;
return ret;
}
struct ns_desc mnt_ns_desc = NS_DESC_ENTRY(CLONE_NEWNS, "mnt");
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