Messages in this thread Patch in this message | | | Date | Mon, 15 Aug 2011 19:11:56 -0400 | From | Ben Blum <> | Subject | [PATCH][BUGFIX] cgroups: fix ordering of calls in cgroup_attach_proc |
| |
Fix ordering of cgroup_task_migrate and attach_task in cgroup_attach_proc.
Signed-off-by: Ben Blum <bblum@andrew.cmu.edu>
--- kernel/cgroup.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
diff -u a/kernel/cgroup.c b/kernel/cgroup.c --- a/kernel/cgroup.c 2011-08-15 19:05:37.308401219 -0400 +++ b/kernel/cgroup.c 2011-08-15 19:07:47.376775142 -0400 @@ -2132,14 +2132,17 @@ oldcgrp = task_cgroup_from_root(tsk, root); if (cgrp == oldcgrp) continue; - /* attach each task to each subsystem */ - for_each_subsys(root, ss) { - if (ss->attach_task) - ss->attach_task(cgrp, tsk); - } /* if the thread is PF_EXITING, it can just get skipped. */ retval = cgroup_task_migrate(cgrp, oldcgrp, tsk, true); - BUG_ON(retval != 0 && retval != -ESRCH); + if (retval == 0) { + /* attach each task to each subsystem */ + for_each_subsys(root, ss) { + if (ss->attach_task) + ss->attach_task(cgrp, tsk); + } + } else { + BUG_ON(retval != -ESRCH); + } } /* nothing is sensitive to fork() after this point. */
| |