]> git.proxmox.com Git - mirror_lxc.git/commitdiff
fix mounts not propagating back to root mntns during create and clone
authorDwight Engen <dwight.engen@oracle.com>
Wed, 19 Feb 2014 21:44:19 +0000 (16:44 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Wed, 19 Feb 2014 23:52:29 +0000 (18:52 -0500)
Systems based on systemd mount the root shared by default. We don't want
mounts done during creation by templates nor those done internally by
bdev during rsync based clones to propagate to the root mntns.

The create case already had the right check, but the mount call was
missing "/", so it was failing.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/bdev.c
src/lxc/lxccontainer.c

index 67fe72baff8de798dc1a8d1b93e0f8dd9a3b0490..ab1c87b35c060b808e6ddc744c33419c0e93c8f9 100644 (file)
@@ -2387,6 +2387,12 @@ static int rsync_rootfs(struct rsync_data *data)
                SYSERROR("unshare CLONE_NEWNS");
                return -1;
        }
+       if (detect_shared_rootfs()) {
+               if (mount(NULL, "/", NULL, MS_SLAVE|MS_REC, NULL)) {
+                       SYSERROR("Failed to make / rslave to run rsync");
+                       ERROR("Continuing...");
+               }
+       }
 
        // If not a snapshot, copy the fs.
        if (orig->ops->mount(orig) < 0) {
index b8b11d62f28046787d31963edce3799b27092327..0d89d1166b1a5f2509314149b8ae1ba84be0d426 100644 (file)
@@ -913,7 +913,7 @@ static bool create_run_template(struct lxc_container *c, char *tpath, bool quiet
                                exit(1);
                        }
                        if (detect_shared_rootfs()) {
-                               if (mount("", "", NULL, MS_SLAVE|MS_REC, 0)) {
+                               if (mount(NULL, "/", NULL, MS_SLAVE|MS_REC, NULL)) {
                                        SYSERROR("Failed to make / rslave to run template");
                                        ERROR("Continuing...");
                                }