Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@virtuozzo.com>2017-03-23 08:09:29 +0300
committerAndrei Vagin <avagin@virtuozzo.com>2017-03-27 19:52:55 +0300
commit8d2ece724857b2d611a0c88b42a6ac36c33c584e (patch)
treeff3939ffb908ea86a6e63d4cfe02b5a15c5b5917
parent40738f7b6a185a5de14680a27961dfd31d5795a6 (diff)
mount: don't collect mounts when they are not required
Currently we collect mounts to clean up a mount namespace, but it isn't required when we are going to call pivot_root. https://github.com/docker/docker/issues/31663 Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
-rw-r--r--criu/mount.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/criu/mount.c b/criu/mount.c
index 2973d27b8..736eaf456 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -2901,7 +2901,6 @@ void cleanup_mnt_ns(void)
int prepare_mnt_ns(void)
{
int ret = -1, rst = -1;
- struct mount_info *old;
struct ns_id ns = { .type = NS_CRIU, .ns_pid = PROC_SELF, .nd = &mnt_ns_desc };
struct ns_id *nsid;
@@ -2910,27 +2909,30 @@ int prepare_mnt_ns(void)
pr_info("Restoring mount namespace\n");
- old = collect_mntinfo(&ns, false);
- if (old == NULL)
- return -1;
-
if (!opts.root) {
+ struct mount_info *old;
+
if (chdir("/")) {
pr_perror("chdir(\"/\") failed");
return -1;
}
+ old = collect_mntinfo(&ns, false);
+ if (old == NULL)
+ return -1;
/*
* The new mount namespace is filled with the mountpoint
* clones from the original one. We have to umount them
* prior to recreating new ones.
*/
pr_info("Cleaning mount namespace\n");
- if (mnt_tree_for_each_reverse(ns.mnt.mntinfo_tree, do_umount_one))
+ if (mnt_tree_for_each_reverse(ns.mnt.mntinfo_tree, do_umount_one)) {
+ free_mntinfo(old);
return -1;
- }
+ }
- free_mntinfo(old);
+ free_mntinfo(old);
+ }
ret = populate_mnt_ns();
if (ret)