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) ...@@ -536,7 +536,7 @@ int cr_check(void)
if (!is_root_user()) if (!is_root_user())
return -1; return -1;
if (mntns_collect_root(getpid())) { if (mntns_collect_root(getpid()) < 0) {
pr_err("Can't collect root mount point\n"); pr_err("Can't collect root mount point\n");
return -1; return -1;
} }
......
...@@ -1659,7 +1659,7 @@ int cr_pre_dump_tasks(pid_t pid) ...@@ -1659,7 +1659,7 @@ int cr_pre_dump_tasks(pid_t pid)
if (collect_mount_info(pid)) if (collect_mount_info(pid))
goto err; goto err;
if (mntns_collect_root(root_item->pid.real)) if (mntns_collect_root(root_item->pid.real) < 0)
goto err; goto err;
for_each_pstree_item(item) for_each_pstree_item(item)
...@@ -1769,7 +1769,7 @@ int cr_dump_tasks(pid_t pid) ...@@ -1769,7 +1769,7 @@ int cr_dump_tasks(pid_t pid)
if (collect_mount_info(pid)) if (collect_mount_info(pid))
goto err; goto err;
if (mntns_collect_root(root_item->pid.real)) if (mntns_collect_root(root_item->pid.real) < 0)
goto err; goto err;
if (collect_sockets(pid)) if (collect_sockets(pid))
......
...@@ -1254,7 +1254,7 @@ static int restore_task_with_children(void *_arg) ...@@ -1254,7 +1254,7 @@ static int restore_task_with_children(void *_arg)
if (close_old_fds(current)) if (close_old_fds(current))
exit(1); exit(1);
if (mntns_collect_root(getpid())) if (mntns_collect_root(getpid()) < 0)
exit(1); exit(1);
if (root_prepare_shared()) if (root_prepare_shared())
......
...@@ -836,7 +836,7 @@ int dump_mnt_ns(int ns_pid, int ns_id) ...@@ -836,7 +836,7 @@ int dump_mnt_ns(int ns_pid, int ns_id)
if (img_fd < 0) if (img_fd < 0)
return -1; return -1;
if (mntns_collect_root(ns_pid)) if (mntns_collect_root(ns_pid) < 0)
goto err; goto err;
pm = parse_mountinfo(ns_pid); pm = parse_mountinfo(ns_pid);
...@@ -1772,7 +1772,7 @@ int mntns_collect_root(pid_t pid) ...@@ -1772,7 +1772,7 @@ int mntns_collect_root(pid_t pid)
set_root: set_root:
ret = install_service_fd(ROOT_FD_OFF, fd); ret = install_service_fd(ROOT_FD_OFF, fd);
close(fd); close(fd);
return ret < 0 ? -1 : 0; return ret;
} }
struct ns_desc mnt_ns_desc = NS_DESC_ENTRY(CLONE_NEWNS, "mnt"); 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