[PATCH] cgroup: fix attach task fail when subtree_control configured

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Zhaoyang Huang <zhaoyang.huang@xxxxxxxxxx>

It is found that task attach to a vacant cgroup will fail when its
subtree_control has been configured. Fix it by judging if there is no chrildren
existed.

Signed-off-by: Zhaoyang Huang <zhaoyang.huang@xxxxxxxxxx>
---
 kernel/cgroup/cgroup.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 919194d..f00583b 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -2561,6 +2561,9 @@ static int cgroup_migrate_execute(struct cgroup_mgctx *mgctx)
  */
 int cgroup_migrate_vet_dst(struct cgroup *dst_cgrp)
 {
+	struct cgroup_subsys_state *css = &dst_cgrp->self;
+	struct list_head *children = &css->children;
+
 	/* v1 doesn't have any restriction */
 	if (!cgroup_on_dfl(dst_cgrp))
 		return 0;
@@ -2581,7 +2584,7 @@ int cgroup_migrate_vet_dst(struct cgroup *dst_cgrp)
 		return 0;
 
 	/* apply no-internal-process constraint */
-	if (dst_cgrp->subtree_control)
+	if (dst_cgrp->subtree_control && !list_empty(children))
 		return -EBUSY;
 
 	return 0;
-- 
1.9.1




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux