[Devel] [PATCH] hoot_ct: do not change a set of CT0's mountpoints
Andrey Vagin
avagin at openvz.org
Wed Jan 29 13:05:34 PST 2014
for that we must remount root with MS_PRIVATE before doing anything else.
https://bugzilla.openvz.org/show_bug.cgi?id=2879
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
src/lib/hooks_ct.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/lib/hooks_ct.c b/src/lib/hooks_ct.c
index c7a3ec5..488acd8 100644
--- a/src/lib/hooks_ct.c
+++ b/src/lib/hooks_ct.c
@@ -104,6 +104,11 @@ int ct_chroot(const char *root)
char oldroot[] = "vzctl-old-root.XXXXXX";
int ret = VZ_RESOURCE_ERROR;
+ if (mount("", "/", NULL, MS_PRIVATE|MS_REC, NULL) < 0) {
+ logger(-1, errno, "Can't remount root with MS_PRIVATE");
+ return ret;
+ }
+
/* root must be bind-mounted to itself to not show what is under it
*
* Linux kernel commit 5ff9d8a6
@@ -119,11 +124,6 @@ int ct_chroot(const char *root)
return ret;
}
- if (mount("", "/", NULL, MS_PRIVATE|MS_REC, NULL) < 0) {
- logger(-1, errno, "Can't remount root with MS_PRIVATE");
- return ret;
- }
-
if (mkdtemp(oldroot) == NULL) {
logger(-1, errno, "Can't mkdtemp %s", oldroot);
return ret;
--
1.8.3.1
More information about the Devel
mailing list