[lxc-devel] [lxc/master] start: set handler state to STOPPED

brauner on Github lxc-bot at linuxcontainers.org
Fri Dec 15 15:26:22 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20171215/caa4778b/attachment.bin>
-------------- next part --------------
From e00577b167464cf6afbd55e429361c223b121c89 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Fri, 15 Dec 2017 16:25:30 +0100
Subject: [PATCH] start: set handler state to STOPPED

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/start.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/lxc/start.c b/src/lxc/start.c
index e17507606..a2c9a386a 100644
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -798,6 +798,14 @@ void lxc_fini(const char *name, struct lxc_handler *handler)
 		 */
 		close(handler->conf->maincmd_fd);
 		handler->conf->maincmd_fd = -1;
+		TRACE("Closed command socket");
+
+		/* The command socket is now closed which means no one can send
+		 * any command including state clients so no need to take a lock
+		 * as we're guaranteed to be the only ones accessing this field.
+		 */
+		handler->state = STOPPED;
+		TRACE("Set container state to STOPPED");
 	} else {
 		lxc_set_state(name, handler, STOPPED);
 	}


More information about the lxc-devel mailing list