cgroups: add lock for child->cgroups in cgroup_post_fork()
authorLai Jiangshan <[email protected]>
Thu, 8 Jan 2009 02:07:36 +0000 (18:07 -0800)
committerLinus Torvalds <[email protected]>
Thu, 8 Jan 2009 16:31:02 +0000 (08:31 -0800)
commitb12b533fa523e94e0cc9dc23274ae4f9439f1313
tree00a08a34388e835ae3103a6f00c96129d3fa59a4
parentc9d5409f8d46fd0d18b4a4481d9caa04076d87fc
cgroups: add lock for child->cgroups in cgroup_post_fork()

When cgroup_post_fork() is called, child is seen by find_task_by_vpid(),
so child->cgroups maybe be changed, It'll incorrect.

child->cgroups<old>'s refcnt is decreased
child->cgroups<new>'s refcnt is increased
but child->cg_list is added to child->cgroups<old>'s list.

Signed-off-by: Lai Jiangshan <[email protected]>
Reviewed-by: Paul Menage <[email protected]>
Cc: KAMEZAWA Hiroyuki <[email protected]>
Cc: Pavel Emelyanov <[email protected]>
Cc: Balbir Singh <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
kernel/cgroup.c