2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-02 15:25:21 +00:00

mnt: Merge two calls to collect_mntinfo on early restore

Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov
2014-04-22 20:39:28 +04:00
parent 8550f52017
commit f55a0b912c

19
mount.c
View File

@@ -1422,7 +1422,7 @@ static int create_mnt_roots(void)
return 0; return 0;
} }
static int rst_collect_local_mntns(void) static int rst_collect_local_mntns(struct mount_info *mi)
{ {
struct ns_id *nsid; struct ns_id *nsid;
@@ -1435,14 +1435,11 @@ static int rst_collect_local_mntns(void)
nsid->pid = getpid(); nsid->pid = getpid();
futex_set(&nsid->created, 1); futex_set(&nsid->created, 1);
mntinfo = collect_mntinfo(nsid); mntinfo = mi;
if (mntinfo == NULL)
return -1;
nsid->next = ns_ids; nsid->next = ns_ids;
ns_ids = nsid; ns_ids = nsid;
pr_info("Add namespace %d pid %d\n", nsid->id, nsid->pid); pr_info("Add local mntns %d pid %d\n", nsid->id, nsid->pid);
return 0; return 0;
} }
@@ -1710,15 +1707,15 @@ int prepare_mnt_ns(void)
struct mount_info *mis, *old; struct mount_info *mis, *old;
struct ns_id ns = { .pid = getpid(), .nd = &mnt_ns_desc }; struct ns_id ns = { .pid = getpid(), .nd = &mnt_ns_desc };
if (!(root_ns_mask & CLONE_NEWNS))
return rst_collect_local_mntns();
pr_info("Restoring mount namespace\n");
old = collect_mntinfo(&ns); old = collect_mntinfo(&ns);
if (old == NULL) if (old == NULL)
return -1; return -1;
if (!(root_ns_mask & CLONE_NEWNS))
return rst_collect_local_mntns(old);
pr_info("Restoring mount namespace\n");
close_proc(); close_proc();
mis = read_mnt_ns_img(); mis = read_mnt_ns_img();