[CRIU] [PATCH 01/14] namespace: don't fail if a namespace isn't supported by kernel
Andrew Vagin
avagin at parallels.com
Tue Oct 14 13:01:26 PDT 2014
On Tue, Oct 14, 2014 at 07:18:36PM +0400, Pavel Emelyanov wrote:
> On 10/14/2014 03:38 PM, Andrey Vagin wrote:
> > CRIU reads /proc/pid/ns/[NS] and fails of a link is not exist.
> >
> > Signed-off-by: Andrey Vagin <avagin at openvz.org>
> > ---
> > namespaces.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/namespaces.c b/namespaces.c
> > index 1feb165..bd7d86e 100644
> > --- a/namespaces.c
> > +++ b/namespaces.c
> > @@ -230,6 +230,11 @@ static unsigned int __get_ns_id(int pid, struct ns_desc *nd, struct ns_id **ns)
> > sprintf(ns_path, "ns/%s", nd->str);
> > ret = readlinkat(proc_dir, ns_path, ns_id, sizeof(ns_id));
> > if (ret < 0) {
> > + if (errno == ENOENT) {
> > + /* The namespace is unsupported */
> > + kid = 0;
>
> Then it should "live" in CRIU's namespace.
Yes. It lives. This code returns the same kid = 0 for all processes.
>
> > + goto out;
> > + }
> > pr_perror("Can't readlink ns link");
> > return 0;
> > }
> > @@ -237,6 +242,7 @@ static unsigned int __get_ns_id(int pid, struct ns_desc *nd, struct ns_id **ns)
> > kid = parse_ns_link(ns_id, ret, nd);
> > BUG_ON(!kid);
> >
> > +out:
> > return generate_ns_id(pid, kid, nd, ns);
> > }
> >
> >
>
More information about the CRIU
mailing list