this expands c597baa8f9 and 2c6f3fc932.

Also move the block using detect_ramfs_rootfs() from setup_rootfs() to
lxc_setup().

Signed-off-by: Florian Klink <[email protected]>
---
 src/lxc/conf.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index a9d64ba..83b8ffc 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -1506,18 +1506,6 @@ static int setup_rootfs(struct lxc_conf *conf)
                return -1;
        }
 
-       if (detect_ramfs_rootfs()) {
-               if (chroot_into_slave(conf)) {
-                       ERROR("Failed to chroot into slave /");
-                       return -1;
-               }
-       } else if (detect_shared_rootfs()) {
-               if (mount("", "/", NULL, MS_SLAVE|MS_REC, 0)) {
-                       SYSERROR("Failed to make / rslave");
-                       return -1;
-               }
-       }
-
        // First try mounting rootfs using a bdev
        struct bdev *bdev = bdev_init(rootfs->path, rootfs->mount, 
rootfs->options);
        if (bdev && bdev->ops->mount(bdev) == 0) {
@@ -3707,6 +3695,25 @@ void tmp_proc_unmount(struct lxc_conf *lxc_conf)
 
 int lxc_setup(struct lxc_handler *handler)
 {
+       if (detect_shared_rootfs()) {
+               if (mount(NULL, "/", NULL, MS_SLAVE|MS_REC, NULL)) {
+                       SYSERROR("Failed to make / rslave");
+                       ERROR("Continuing...");
+               }
+       }
+
+       if (detect_ramfs_rootfs()) {
+               if (chroot_into_slave(conf)) {
+                       ERROR("Failed to chroot into slave /");
+                       return -1;
+               }
+       } else if (detect_shared_rootfs()) {
+               if (mount("", "/", NULL, MS_SLAVE|MS_REC, 0)) {
+                       SYSERROR("Failed to make / rslave");
+                       return -1;
+               }
+       }
+
        const char *name = handler->name;
        struct lxc_conf *lxc_conf = handler->conf;
        const char *lxcpath = handler->lxcpath;
-- 
1.9.1
_______________________________________________
lxc-users mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-users

Reply via email to