[PATCH] cgroup: Fixes the un-paired cgroup lock problem

From: Liu Aleaxander
Date: Tue Nov 03 2009 - 20:40:46 EST


From: Liu Aleaxander <Aleaxander@xxxxxxxxx>
Date: Wed, 4 Nov 2009 09:27:06 +0800
Subject: [PATCH] Fixes the un-paired cgroup lock problem

In cgroup_lock_live_group, it locks the cgroup by mutex_lock, while in the
cgroup_tasks_write, it unlock it by cgroup_unlock. Even though they are
equal, but I do think we should make it pair.

BTW, should we replace others with cgroup_lock and cgroup_unlock?
Since we already have a wrapper one and it's meaningful.

Signed-off-by: Liu Aleaxander <Aleaxander@xxxxxxxxx>
---
kernel/cgroup.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 0249f4b..ee2274e 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1660,9 +1660,9 @@ static int cgroup_tasks_write(struct cgroup
*cgrp, struct cftype *cft, u64 pid)
*/
bool cgroup_lock_live_group(struct cgroup *cgrp)
{
- mutex_lock(&cgroup_mutex);
+ cgroup_lock();
if (cgroup_is_removed(cgrp)) {
- mutex_unlock(&cgroup_mutex);
+ cgroup_unlock();
return false;
}
return true;
--
1.6.2.5

--
regards
Liu Aleaxander
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/