[Devel] [PATCH] eclone: fix do_alloc_pidmap bogosity on -EAGAIN

Serge E. Hallyn serue at us.ibm.com
Fri Nov 13 13:05:13 PST 2009


do_alloc_pidmap must not return 0 if it failed to find a pid.
Without this patch, doing eclone and choosing a pid which is in
use results in a massive chain of oopses.

(This applies on top of the v13 eclone patchset)

Signed-off-by: Serge E. Hallyn <serue at us.ibm.com>
---
 kernel/pid.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/pid.c b/kernel/pid.c
index 3ee52cd..8ad7b04 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -164,6 +164,7 @@ static int do_alloc_pidmap(struct pid_namespace *pid_ns, int last, int min,
 		rc = alloc_pidmap_page(map);
 		if (rc)
 			break;
+		rc = -EAGAIN;
 
 		if (likely(atomic_read(&map->nr_free))) {
 			do {
@@ -189,10 +190,8 @@ static int do_alloc_pidmap(struct pid_namespace *pid_ns, int last, int min,
 		} else {
 			map = &pid_ns->pidmap[0];
 			offset = min;
-			if (unlikely(last == offset)) {
-				rc = -EAGAIN;
+			if (unlikely(last == offset))
 				break;
-			}
 		}
 		pid = mk_pid(pid_ns, map, offset);
 	}
-- 
1.6.1

_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list