Unmount cgroup FS after use
authorJagger <robert@swiecki.net>
Sun, 19 Jun 2016 12:25:41 +0000 (14:25 +0200)
committerJagger <robert@swiecki.net>
Sun, 19 Jun 2016 12:25:41 +0000 (14:25 +0200)
cgroup.c

index 3ed369d35beff555675cc277cfbf6703d72b66f9..df22452dc14936fde712e3a6445deda90525e22a 100644 (file)
--- a/cgroup.c
+++ b/cgroup.c
@@ -25,6 +25,7 @@
 #include <stdarg.h>
 #include <stdio.h>
 #include <string.h>
+#include <sys/mount.h>
 #include <sys/stat.h>
 #include <sys/syscall.h>
 #include <sys/types.h>
@@ -64,5 +65,11 @@ bool cgroupInitNs(struct nsjconf_t *nsjconf)
                return false;
        }
 
+       LOG_D("Unmounting '%s'", nsjconf->cgroup_mem_mount);
+       if (umount2(nsjconf->cgroup_mem_mount, MNT_DETACH) == -1) {
+               PLOG_E("Could not umount2('%s', MNT_DETACH)", nsjconf->cgroup_mem_mount);
+               return false;
+       }
+
        return true;
 }