Subject: Re: [vserver] [PATCH] soft limit bug fix
From: Herbert Poetzl <herbert@13thfloor.at>
Date: Thu, 25 Oct 2007 12:11:41 +0200

On Thu, Oct 25, 2007 at 11:44:11AM +0900, Jun Kawashima wrote:
> Hi all,
> 
> I found a trivial bug about return value of soft limit in 
> limit_int.h and this is the patch.
> 
> Comment says the function __vx_cres_avail() return -1 when 
> resource is over soft limit, but it returns 1.

thanks, nice catch, although I would prefer to adjust
the comment to match the reality than the other way
round ...

best,
Herbert

> I'm using patch-2.6.22.9-vs2.2.0.4.diff.
> 
> Thanks.
> 
> ---
> diff -uprN linux-2.6.22.9.orig/include/linux/vserver/limit_int.h
> linux-2.6.22.9/include/linux/vserver/limit_int.h
> --- linux-2.6.22.9.orig/include/linux/vserver/limit_int.h	2007-10-25
> 10:53:18.000000000 +0900
> +++ linux-2.6.22.9/include/linux/vserver/limit_int.h	2007-10-25
> 10:57:39.000000000 +0900
> @@ -101,14 +101,14 @@ static inline int __vx_cres_avail(struct
>  		return 1;
> 
>  	if (__rlim_soft(limit, res) == RLIM_INFINITY)
> -		return -1;
> +		return 1;
>   	if (value + num <= __rlim_soft(limit, res))
> -		return -1;
> +		return 1;
> 
>  	if (__rlim_hard(limit, res) == RLIM_INFINITY)
> -		return 1;
> +		return -1;
>   	if (value + num <= __rlim_hard(limit, res))
> -		return 1;
> +		return -1;
> 
>  	__rlim_hit(limit, res);
>  	return 0;
> ---