res_counter: fix off-by-one bug in setting limit
authorLi Zefan <lizf@cn.fujitsu.com>
Fri, 5 Sep 2008 21:00:18 +0000 (14:00 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 5 Sep 2008 21:39:37 +0000 (14:39 -0700)
commit11d55d2cba6e867be8955e5ae011c54c556b849f
tree53a0746c05e5922a2c35db9201d8d92818c4ed67
parent7f621861fbdb1ea90c36b1a59a45cb84b4a2239f
res_counter: fix off-by-one bug in setting limit

I found we can no longer set limit to 0 with 2.6.27-rcX:
 # mount -t cgroup -omemory xxx /mnt
 # mkdir /mnt/0
 # echo 0 > /mnt/0/memory.limit_in_bytes
 bash: echo: write error: Device or resource busy

It turned out 'limit' can't be set to 'usage', which is wrong IMO.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Acked-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/res_counter.h