From: Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
To: Dan Smith <danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org,
adobriyan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Subject: Re: [PATCH] c/r: Add UTS support (v3)
Date: Wed, 18 Mar 2009 05:22:43 -0400 [thread overview]
Message-ID: <49C0BD63.7000309@cs.columbia.edu> (raw)
In-Reply-To: <1237306139-23075-1-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Dan Smith wrote:
> This patch adds a "phase" of checkpoint that saves out information about any
> namespaces the task(s) may have. Do this by tracking the nsproxy of the
> first task and making sure that the tasks that follow get hooked back to
> share the same one on restart.
>
> Restart is handled in userspace by reading the UTS record(s), calling
> unshare() and setting the hostname accordingly. See my changes to
> mktree.c for details.
>
> I tested this with single and multiple task restore, on top of Oren's
> v13 tree.
Thanks, Dan.
[..]
> diff --git a/checkpoint/checkpoint.c b/checkpoint/checkpoint.c
> index 64155de..12eb1d5 100644
> --- a/checkpoint/checkpoint.c
> +++ b/checkpoint/checkpoint.c
> @@ -193,6 +193,82 @@ static int cr_write_tail(struct cr_ctx *ctx)
> return ret;
> }
>
> +static int cr_write_ns_uts(struct cr_ctx *ctx, struct task_struct *t)
> +{
> + struct cr_hdr h;
> + struct cr_hdr_utsns *hh = cr_hbuf_get(ctx, sizeof(*hh));
> + struct new_utsname *n = &t->nsproxy->uts_ns->name;
> + int ret;
> +
> + h.type = CR_HDR_UTSNS;
> + h.len = sizeof(*hh);
> + h.parent = 0;
> +
> + memcpy(hh->nodename, n->nodename, sizeof(n->nodename));
> + memcpy(hh->domainname, n->domainname, sizeof(n->domainname));
> +
The length of ->nodename etc may change in the future. It's probably
safer to also add the length of the field as well (see for instance
how task->comm is saved).
> + ret = cr_write_obj(ctx, &h, hh);
> + cr_hbuf_put(ctx, sizeof(*hh));
> +
> + return ret;
> +}
[...]
> @@ -156,4 +158,17 @@ struct cr_hdr_fd_data {
> __u64 f_version;
> } __attribute__((aligned(8)));
>
> +#define CR_NSP_UTS 1
> +
> +struct cr_hdr_nsproxy {
> + __u32 objref;
> + __u32 types;
> +};
> +
> +struct cr_hdr_utsns {
> + /* Both of these fields are defined as 65-chars long */
> + char nodename[__NEW_UTS_LEN+1];
> + char domainname[__NEW_UTS_LEN+1];
> +};
add ?
__u16 nodename_len;
__u16 domainname_len;
> +
> #endif /* _CHECKPOINT_CKPT_HDR_H_ */
Oren.
next prev parent reply other threads:[~2009-03-18 9:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-17 16:08 [PATCH] c/r: Add UTS support (v3) Dan Smith
[not found] ` <1237306139-23075-1-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-03-18 9:22 ` Oren Laadan [this message]
[not found] ` <49C0BD63.7000309-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-18 13:30 ` Dan Smith
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=49C0BD63.7000309@cs.columbia.edu \
--to=orenl-eqauephvms7envbuuze7ea@public.gmane.org \
--cc=adobriyan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
--cc=danms-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 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.