]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
waitpid at abort to make sure we can rmdir cgroups
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Thu, 30 May 2013 16:22:16 +0000 (11:22 -0500)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Fri, 31 May 2013 12:45:23 +0000 (07:45 -0500)
If we abort the container start, and don't wait for the init task to be
reaped after we kill it, then we can't remove the container cgroup
because it is not empty.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/start.c

index d43d580731904548b4e88a3495c0ffca8ff6d5b7..5092b51cf521a9c4fab6532e29581b90b2c64535 100644 (file)
@@ -451,9 +451,12 @@ static void lxc_fini(const char *name, struct lxc_handler *handler)
 
 void lxc_abort(const char *name, struct lxc_handler *handler)
 {
+       int ret, status;
+
        lxc_set_state(name, handler, ABORTING);
        if (handler->pid > 0)
                kill(handler->pid, SIGKILL);
+       while ((ret = waitpid(-1, &status, 0)) > 0) ;
 }
 
 #include <sys/reboot.h>