[lxc-devel] [PATCH 1/1] api_clone: call is_stopped_locked() to avoid deadlock.

Serge Hallyn serge.hallyn at ubuntu.com
Tue May 28 20:31:40 UTC 2013


(fyi - I've pushed this to staging to lxc-clone to work again.)

Switch lxcapi_clone to use the non-locking is_stopped_locked() instead
of c->is_running.

Technically as (IIRC) Dwight has mentioned we should probably drop the
locking from api_state() altogether, since those are protected through the
lxc command system.

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
---
 src/lxc/lxccontainer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index 2ea9556..b34b8e8 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -1827,7 +1827,7 @@ struct lxc_container *lxcapi_clone(struct lxc_container *c, const char *newname,
 	if (container_mem_lock(c))
 		return NULL;
 
-	if (c->is_running(c)) {
+	if (!is_stopped_locked(c)) {
 		ERROR("error: Original container (%s) is running", c->name);
 		goto out;
 	}
-- 
1.8.1.2





More information about the lxc-devel mailing list