[lxc-users] [PATCH] check whether rootfs is shared before running hooks

Florian Klink flokli at flokli.de
Wed Mar 26 11:03:04 UTC 2014


this expands c597baa8f9 and 2c6f3fc932.
---
 src/lxc/start.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/lxc/start.c b/src/lxc/start.c
index ec10496..40696e9 100644
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -409,6 +409,13 @@ struct lxc_handler *lxc_init(const char *name, struct lxc_conf *conf, const char
 	}
 	/* End of environment variable setup for hooks */
 
+	if (detect_shared_rootfs()) {
+		if (mount(NULL, "/", NULL, MS_SLAVE|MS_REC, NULL)) {
+			SYSERROR("Failed to make / rslave");
+			ERROR("Continuing...");
+		}
+	}
+
 	if (run_lxc_hooks(name, "pre-start", conf, handler->lxcpath, NULL)) {
 		ERROR("failed to run pre-start hooks for container '%s'.", name);
 		goto out_aborting;
-- 
1.9.1


More information about the lxc-users mailing list