[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87fw2zmgzc.fsf@xmission.com>
Date: Fri, 21 Dec 2012 09:51:03 -0800
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Oleg Nesterov <oleg@...hat.com>
Cc: Linux Containers <containers@...ts.linux-foundation.org>,
linux-kernel@...r.kernel.org, Serge Hallyn <serge@...lyn.com>,
Gao feng <gaofeng@...fujitsu.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 11/11] pidns: Support unsharing the pid namespace.
Oleg Nesterov <oleg@...hat.com> writes:
> Eric. I understand that it is too late to discuss this. And yes, I simply
> do not understand the problem space, I never used containers.
>
> But, stupid question. Let's ignore the pid_ns-specific oddities.
>
> 1. Ignoring setns(), why do we need /proc/pid/ns/ ?
>
> 2. Why setns() requires /proc/pid/ns/ ? IOW, why it can't be
>
> sys_setns(pid_t pid, int clone_flags)
> {
> truct task_struct *tsk = find_task_by_vpid(pid);
> struct nsproxy *target = get_nsproxy(tsk->nsproxy);
>
> new_nsproxy = create_new_namespaces(...);
>
> if (clone_flags & CLONE_NEWNS)
> mntns_install(...);
> if (clone_flags & CLONE_NEWIPC)
> ipcns_install(...);
> ...
> }
>
> I feel I missed something trivial, but what?
It is a question of naming.
The problem I set out to solve when all of this was introduced was how
to name namespaces without introducing yet another namespace.
The solution to the naming problem that I finally found was to introduce
something I could mount. Using a file in /proc I can bind mount it
anywhere in the mount namespace with any name. That gives me names for
namespaces in the mount namespace. Furthermore those names go away
when the mount namespace goes away making them very easy to manage.
Being able to open the file instead of passing a path to setns
allows a process for private per process naming (via file descriptors).
To get a practical feel of this it may be worth looking at iproute.
ip netns add
ip netns del
ip netns exec
Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists