[lxc-devel] [lxc/master] lxccontainer: remove cgroup locking

brauner on Github lxc-bot at linuxcontainers.org
Thu Sep 20 20:50:46 UTC 2018


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/20180920/664590fd/attachment.bin>
-------------- next part --------------
From 03095169caecb4ca85ebb9dda5e634cb9cc28c27 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Thu, 20 Sep 2018 22:34:10 +0200
Subject: [PATCH 1/2] lxccontainer: remove locks from set_cgroup_item()

The on-disk config file is not altered and the in-memory config isn't
altered so no need for locking.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/lxccontainer.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index 30b181b8c..194a1bd01 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -3277,13 +3277,8 @@ static bool do_lxcapi_set_cgroup_item(struct lxc_container *c, const char *subsy
 	if (!cgroup_ops)
 		return false;
 
-	if (container_disk_lock(c))
-		return false;
-
 	ret = cgroup_ops->set(cgroup_ops, subsys, value, c->name, c->config_path);
 
-	container_disk_unlock(c);
-
 	cgroup_exit(cgroup_ops);
 
 	return ret == 0;

From 152508ba09adc41ec7199b395f4cbbdd4327399b Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Thu, 20 Sep 2018 22:34:59 +0200
Subject: [PATCH 2/2] lxccontainer: remove locks from get_cgroup_item()

The on-disk config file is not altered and the in-memory config isn't
altered so no need for locking.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/lxccontainer.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index 194a1bd01..bdfe057cc 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -3301,14 +3301,9 @@ static int do_lxcapi_get_cgroup_item(struct lxc_container *c, const char *subsys
 	if (!cgroup_ops)
 		return -1;
 
-	if (container_disk_lock(c))
-		return -1;
-
 	ret = cgroup_ops->get(cgroup_ops, subsys, retv, inlen, c->name,
 			      c->config_path);
 
-	container_disk_unlock(c);
-
 	cgroup_exit(cgroup_ops);
 
 	return ret;


More information about the lxc-devel mailing list