Subject: [PATCH] soft limit bug fix
From: "Jun Kawashima" <junkawa@gmail.com>
Date: Thu, 25 Oct 2007 11:44:11 +0900

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.

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;
---