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 RFC linux-cr] add rpid to ckpt_pids struct
Date: Tue, 9 Mar 2010 15:04:51 -0600 [thread overview]
Message-ID: <20100309210450.GA5789@us.ibm.com> (raw)
When we restart an application, we won't try to restore the original
pid in the parent pid_ns, so we don't checkpoint that pid.
However, if we are going to dump mount info from userspace using
/proc/pid/mountinfo, then it will be easiest for a restart wrapper
to use the pids from the checkpoint image. So add rpid to the
pids info we dump.
The rpid is taken as the vpid in the checkpointer's pidnamespace.
The container may not have valid pids in the checkpointer's
pid namespace, in which case the rpid will be 0, and the checkpoint
wrapper will not be able to access the mountinfo.
Note that eventually, in order to restore nested pid namespaces,
we will need to change our approach again, so as to print out
the pid in every ancestor pid_ns.
Signed-off-by: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
checkpoint/checkpoint.c | 6 ++++--
include/linux/checkpoint_hdr.h | 1 +
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/checkpoint/checkpoint.c b/checkpoint/checkpoint.c
index b3c1c4f..c9b5966 100644
--- a/checkpoint/checkpoint.c
+++ b/checkpoint/checkpoint.c
@@ -329,13 +329,15 @@ static int checkpoint_pids(struct ckpt_ctx *ctx)
for (n = 0; n < min(nr_tasks, CKPT_HDR_PIDS_CHUNK); n++) {
task = tasks_arr[pos];
+ h[n].rpid = task_pid_vnr(task);
h[n].vpid = task_pid_nr_ns(task, ns);
h[n].vtgid = task_tgid_nr_ns(task, ns);
h[n].vpgid = task_pgrp_nr_ns(task, ns);
h[n].vsid = task_session_nr_ns(task, ns);
h[n].vppid = task_tgid_nr_ns(task->real_parent, ns);
- ckpt_debug("task[%d]: vpid %d vtgid %d parent %d\n",
- pos, h[n].vpid, h[n].vtgid, h[n].vppid);
+ ckpt_debug("task[%d]: rpid %d vpid %d vtgid %d "
+ "parent %d\n", pos, h[n].rpid, h[n].vpid,
+ h[n].vtgid, h[n].vppid);
pos++;
}
rcu_read_unlock();
diff --git a/include/linux/checkpoint_hdr.h b/include/linux/checkpoint_hdr.h
index 41412d1..d3fff0b 100644
--- a/include/linux/checkpoint_hdr.h
+++ b/include/linux/checkpoint_hdr.h
@@ -327,6 +327,7 @@ struct ckpt_hdr_tree {
} __attribute__((aligned(8)));
struct ckpt_pids {
+ __s32 rpid; /* pid in checkpointer's pidns */
__s32 vpid;
__s32 vppid;
__s32 vtgid;
--
1.6.0.6
next reply other threads:[~2010-03-09 21:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-09 21:04 Serge E. Hallyn [this message]
[not found] ` <20100309210450.GA5789-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-03-09 22:11 ` [PATCH RFC linux-cr] add rpid to ckpt_pids struct Matt Helsley
[not found] ` <20100309221143.GO20106-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2010-03-09 22:42 ` Serge E. Hallyn
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=20100309210450.GA5789@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.