Linux Container Development
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Sukadev Bhattiprolu <sukadev-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: Linux Containers <containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>
Subject: [PATCH] eclone: fix do_alloc_pidmap bogosity on -EAGAIN
Date: Fri, 13 Nov 2009 15:05:13 -0600	[thread overview]
Message-ID: <20091113210513.GA28117@us.ibm.com> (raw)

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-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
 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

                 reply	other threads:[~2009-11-13 21:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091113210513.GA28117@us.ibm.com \
    --to=serue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=sukadev-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox