X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=kernel%2Fcgroup_freezer.c;h=59e9ef6aab4002e1d99170f50156e733e8f46343;hb=278498d438781426d8f315b65f7bca023a26fcc0;hp=fb249e2bcada880a19105488c7fdde33e9483126;hpb=52fefcec97c25b15887e6a9a885ca54e7f7c0928;p=~andy%2Flinux diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c index fb249e2bcad..59e9ef6aab4 100644 --- a/kernel/cgroup_freezer.c +++ b/kernel/cgroup_freezer.c @@ -159,7 +159,7 @@ static bool is_task_frozen_enough(struct task_struct *task) */ static int freezer_can_attach(struct cgroup_subsys *ss, struct cgroup *new_cgroup, - struct task_struct *task) + struct task_struct *task, bool threadgroup) { struct freezer *freezer; @@ -177,6 +177,19 @@ static int freezer_can_attach(struct cgroup_subsys *ss, if (freezer->state == CGROUP_FROZEN) return -EBUSY; + if (threadgroup) { + struct task_struct *c; + + rcu_read_lock(); + list_for_each_entry_rcu(c, &task->thread_group, thread_group) { + if (is_task_frozen_enough(c)) { + rcu_read_unlock(); + return -EBUSY; + } + } + rcu_read_unlock(); + } + return 0; }