[CRIU] [PATCH 18/37] mount: return descriptor from mntns_collect_root

Andrey Vagin avagin at openvz.org
Fri Apr 18 07:42:56 PDT 2014


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: Andrey Vagin <avagin at openvz.org>
---
 cr-check.c   | 2 +-
 cr-dump.c    | 4 ++--
 cr-restore.c | 2 +-
 mount.c      | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/cr-check.c b/cr-check.c
index dedec4d..512c2d3 100644
--- a/cr-check.c
+++ b/cr-check.c
@@ -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;
 	}
diff --git a/cr-dump.c b/cr-dump.c
index 14a4098..d135ff4 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -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))
diff --git a/cr-restore.c b/cr-restore.c
index c9b1fc2..e93dd71 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1263,7 +1263,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())
diff --git a/mount.c b/mount.c
index 92af0a4..938abcf 100644
--- a/mount.c
+++ b/mount.c
@@ -832,7 +832,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);
@@ -1757,7 +1757,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");
-- 
1.8.5.3



More information about the CRIU mailing list