Linux Container Development
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
Cc: Linux Containers <containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>
Subject: [PATCH 1/1] cr: user_ns: fix trivial errors
Date: Tue, 16 Jun 2009 15:58:49 -0500	[thread overview]
Message-ID: <20090616205849.GA5402@us.ibm.com> (raw)

Use the right identifier out of CKPT_OBJ_USER and CKPT_OBJ_USER_NS.

Don't do ckpt_hdr_put() twice in do_restore_user_ns

Don't ifdef CONFIG_USER_NS in user_namespace.c which is only compiled
when CONFIG_USER_NS.

Signed-off-by: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
 kernel/user.c           |    2 +-
 kernel/user_namespace.c |    7 ++-----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/kernel/user.c b/kernel/user.c
index 58ec18d..820cc2c 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -545,7 +545,7 @@ static int do_checkpoint_user(struct ckpt_ctx *ctx, struct user_struct *u)
 	do {
 		ns = save_u->user_ns;
 		save_u = ns->creator;
-		if (ckpt_obj_lookup(ctx, save_u, CKPT_OBJ_USER_NS))
+		if (ckpt_obj_lookup(ctx, save_u, CKPT_OBJ_USER))
 			goto found;
 		unsaved_creators[unsaved_ns_nr++] = save_u;
 		if (unsaved_ns_nr == step * UNSAVED_STRIDE) {
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index a8a46a3..eb1a714 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -125,7 +125,7 @@ static int do_checkpoint_userns(struct ckpt_ctx *ctx, struct user_namespace *ns)
 	root_ns = task_cred_xxx(ctx->root_task, user)->user_ns;
 	if (ns != root_ns) {
 		creator_ref = ckpt_obj_lookup(ctx, ns->creator,
-					      CKPT_OBJ_USER_NS);
+					      CKPT_OBJ_USER);
 		if (!creator_ref)
 			return -EINVAL;
 	}
@@ -163,9 +163,7 @@ static struct user_namespace *do_restore_userns(struct ckpt_ctx *ctx)
 		goto out;
 	}
 
-#ifdef CONFIG_USER_NS
 	creator = ckpt_obj_fetch(ctx, h->creator_ref, CKPT_OBJ_USER);
-	ckpt_hdr_put(ctx, h);
 	if (IS_ERR(creator)) {
 		ns = ERR_PTR(-EINVAL);
 		goto out;
@@ -187,10 +185,9 @@ static struct user_namespace *do_restore_userns(struct ckpt_ctx *ctx)
 	 * The objhash will keep the userns pinned until then.
 	 */
 	free_uid(new_root);
-#endif
 
  out:
-	ctx->stats.ipc_ns++;
+	ctx->stats.user_ns++;
 	ckpt_hdr_put(ctx, h);
 	return ns;
 }
-- 
1.6.1

                 reply	other threads:[~2009-06-16 20:58 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=20090616205849.GA5402@us.ibm.com \
    --to=serue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=orenl-eQaUEPhvms7ENvBUuze7eA@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