]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Revert "lxc-cmd-stop: two fixes"
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Tue, 14 Apr 2015 19:56:51 +0000 (14:56 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 14 Apr 2015 23:33:06 +0000 (18:33 -0500)
This breaks code that depended on the monitor being fully dead before
c->stop() returns.

This reverts commit 62e041610609c8913c3d397a521716819a91f850.

src/lxc/commands.c

index c2354af431f70b659901ebecc655583b6dd6cb37..b70ee722632209ed6bd45efff0771aa4d6d0ad24 100644 (file)
@@ -608,13 +608,11 @@ int lxc_cmd_stop(const char *name, const char *lxcpath)
                return -1;
        }
 
-       if (!ret) {
-               WARN("'%s' has stopped before replying with success", name);
-               return -1;
-       }
-
-       if (cmd.rsp.ret != 0) {
-               ERROR("Container %s:%s had an error stopping", lxcpath, name);
+       /* we do not expect any answer, because we wait for the connection to be
+        * closed
+        */
+       if (ret > 0) {
+               ERROR("failed to stop '%s': %s", name, strerror(-cmd.rsp.ret));
                return -1;
        }
 
@@ -639,12 +637,11 @@ static int lxc_cmd_stop_callback(int fd, struct lxc_cmd_req *req,
                 * deadlock us
                 */
                if (cgroup_unfreeze(handler))
-                       goto out;
+                       return 0;
                ERROR("Failed to unfreeze %s:%s", handler->lxcpath, handler->name);
                rsp.ret = -1;
        }
 
-out:
        return lxc_cmd_rsp_send(fd, &rsp);
 }