Ben Blum 77ceab8ea5 cgroups: don't attach task to subsystem if migration failed
If a task has exited to the point it has called cgroup_exit() already,
then we can't migrate it to another cgroup anymore.

This can happen when we are attaching a task to a new cgroup between the
call to ->can_attach_task() on subsystems and the migration that is
eventually tried in cgroup_task_migrate().

In this case cgroup_task_migrate() returns -ESRCH and we don't want to
attach the task to the subsystems because the attachment to the new cgroup
itself failed.

Fix this by only calling ->attach_task() on the subsystems if the cgroup
migration succeeded.

Reported-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Ben Blum <bblum@andrew.cmu.edu>
Acked-by: Paul Menage <paul@paulmenage.org>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-02 16:06:59 -07:00
..
2011-07-26 16:49:45 -07:00
2010-08-09 16:48:42 -04:00
2011-03-14 09:15:23 -04:00
2011-07-26 16:49:47 -07:00
2010-10-30 01:42:19 -04:00
2011-07-26 16:49:47 -07:00
2011-05-19 18:51:57 +10:00
2011-09-23 12:05:29 +05:30
2011-03-31 11:26:23 -03:00
2011-07-26 16:49:47 -07:00
2011-07-14 12:59:14 +03:00
2011-10-31 17:30:45 -07:00
2011-10-31 17:30:45 -07:00
2011-09-15 15:08:18 +02:00
2011-10-04 12:43:53 +02:00
2010-10-01 10:50:58 -07:00
2011-03-31 11:26:23 -03:00
2011-07-26 16:49:45 -07:00
2011-05-24 12:10:51 +02:00
2011-07-26 16:49:47 -07:00
2011-03-31 11:26:23 -03:00
2011-04-24 13:18:38 +02:00
2011-08-14 12:00:41 +02:00
2011-10-06 12:47:04 +02:00
2011-10-31 17:30:44 -07:00
2011-08-12 16:21:35 -05:00
2011-09-19 17:04:37 -07:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00