Daisuke Nishimura 40d58138f8 memcg: fix error path of mem_cgroup_move_parent
There is a bug in error path of mem_cgroup_move_parent.

Extra refcnt got from try_charge should be dropped, and usages incremented
by try_charge should be decremented in both error paths:

    A: failure at get_page_unless_zero
    B: failure at isolate_lru_page

This bug makes this parent directory unremovable.

In case of A, rmdir doesn't return, because res.usage doesn't go down to 0
at mem_cgroup_force_empty even after all the pc in lru are removed.

In case of B, rmdir fails and returns -EBUSY, because it has extra ref
counts even after res.usage goes down to 0.

Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: Paul Menage <menage@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-15 16:39:39 -08:00
..
2008-12-29 11:27:46 +02:00
2009-01-06 15:59:14 -08:00
2009-01-06 15:59:08 -08:00
2007-10-20 01:27:18 +02:00
2008-07-28 16:30:21 -07:00
2009-01-08 08:31:07 -08:00
2009-01-08 08:31:05 -08:00
2008-06-12 18:05:41 -07:00
2009-01-01 10:12:29 +10:30
2007-10-20 01:27:18 +02:00
2009-01-08 08:31:10 -08:00
2009-01-01 10:12:29 +10:30
2008-11-30 10:03:35 -08:00
2009-01-08 08:31:05 -08:00
2009-01-08 08:31:08 -08:00
2009-01-15 16:39:35 -08:00
2009-01-01 10:12:29 +10:30