Home » Mailing lists » Devel » [patch -mm 00/17] new namespaces and related syscalls
Re: [patch -mm 08/17] nsproxy: add hashtable [message #16823 is a reply to message #16810] |
Tue, 05 December 2006 23:36   |
Herbert Poetzl
Messages: 239 Registered: February 2006
|
Senior Member |
|
|
On Tue, Dec 05, 2006 at 11:28:00AM +0100, clg@fr.ibm.com wrote:
> From: Cedric Le Goater <clg@fr.ibm.com>
>
> This patch adds a hashtable of nsproxy using the nsproxy as a key.
> init_nsproxy is hashed at init with key 0. This is considered to be
> the 'host' nsproxy.
hmm? how is that going to work?
I mean, a simple clone() call (on the host) will
change the nsproxy and spawn new ones, but that
doesn't mean that the process has left the 'host'
it just means that some namespace is not shared
with the 'other' processes ...
best,
Herbert
> Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
> ---
> include/linux/nsproxy.h | 3 +++
> kernel/nsproxy.c | 43 +++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 46 insertions(+)
>
> Index: 2.6.19-rc6-mm2/include/linux/nsproxy.h
> ===================================================================
> --- 2.6.19-rc6-mm2.orig/include/linux/nsproxy.h
> +++ 2.6.19-rc6-mm2/include/linux/nsproxy.h
> @@ -2,6 +2,7 @@
> #define _LINUX_NSPROXY_H
>
> #include <linux/spinlock.h>
> +#include <linux/list.h>
>
> struct task_struct;
>
> @@ -34,6 +35,8 @@ struct nsproxy {
> struct pid_namespace *pid_ns;
> struct net_namespace *net_ns;
> struct user_namespace *user_ns;
> +
> + struct hlist_node ns_hash_node;
> };
> extern struct nsproxy init_nsproxy;
>
> Index: 2.6.19-rc6-mm2/kernel/nsproxy.c
> ===================================================================
> --- 2.6.19-rc6-mm2.orig/kernel/nsproxy.c
> +++ 2.6.19-rc6-mm2/kernel/nsproxy.c
> @@ -22,6 +22,15 @@
> #include <linux/pid_namespace.h>
> #include <linux/net_namespace.h>
>
> +#define NS_HASH_BITS 3 /* this might need some configuration */
> +#define NS_HASH_SIZE (1 << NS_HASH_BITS)
> +#define NS_HASH_MASK (NS_HASH_SIZE - 1)
> +#define ns_hashfn(id) (((id >> NS_HASH_BITS) + id) & NS_HASH_MASK)
> +#define ns_hash_head(id) &ns_hash[ns_hashfn(id)]
> +
> +static struct hlist_head ns_hash[NS_HASH_SIZE];
> +static DEFINE_SPINLOCK(ns_hash_lock);
> +
> struct nsproxy init_nsproxy = INIT_NSPROXY(init_nsproxy);
>
> static inline void get_nsproxy(struct nsproxy *ns)
> @@ -190,3 +199,37 @@ void put_nsproxy(struct nsproxy *ns)
> free_nsproxy(ns);
> }
> }
> +
> +/*
> + * This routine must be called with the ns_hash spin_locked
> + */
> +static inline struct nsproxy *ns_hash_find(int id)
> +{
> + struct hlist_node *elem;
> + struct nsproxy *ns;
> +
> + hlist_for_each_entry(ns, elem, ns_hash_head(id), ns_hash_node) {
> + if (ns->id == id) {
> + get_nsproxy(ns);
> + return ns;
> + }
> + }
> +
> + return NULL;
> +}
> +
> +static int __init nshash_init(void)
> +{
> + int i;
> +
> + for (i = 0; i < NS_HASH_SIZE; ++i)
> + INIT_HLIST_HEAD(&ns_hash[i]);
> +
> + spin_lock_irq(&ns_hash_lock);
> + hlist_add_head(&init_nsproxy.ns_hash_node, ns_hash_head(0));
> + spin_unlock_irq(&ns_hash_lock);
> +
> + return 0;
> +}
> +
> +module_init(nshash_init);
>
> --
> _______________________________________________
> Containers mailing list
> Containers@lists.osdl.org
> https://lists.osdl.org/mailman/listinfo/containers
_______________________________________________
Containers mailing list
Containers@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/containers
|
|
|
 |
|
[patch -mm 00/17] new namespaces and related syscalls
|
 |
|
[patch -mm 01/17] net namespace: empty framework
|
 |
|
[patch -mm 02/17] user namespace: add the framework
|
 |
|
[patch -mm 03/17] namespace : export unshare of namespace and fs_struct
|
 |
|
[patch -mm 04/17] nsproxy: externalizes exit_task_namespaces
|
 |
|
Re: [patch -mm 04/17] nsproxy: externalizes exit_task_namespaces
By: ebiederm on Fri, 08 December 2006 20:16
|
 |
|
Re: [patch -mm 04/17] nsproxy: externalizes exit_task_namespaces
|
 |
|
[patch -mm 05/17] ipc namespace : externalizes unshare_ipcs
|
 |
|
Re: [patch -mm 05/17] ipc namespace : externalizes unshare_ipcs
|
 |
|
Re: [patch -mm 05/17] ipc namespace : externalizes unshare_ipcs
|
 |
|
[patch -mm 06/17] nsproxy: add extern to nsproxy functions
|
 |
|
[patch -mm 07/17] nsproxy: make put_nsproxy an extern
|
 |
|
[patch -mm 08/17] nsproxy: add hashtable
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
By: ebiederm on Fri, 08 December 2006 19:30
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
By: serue on Fri, 08 December 2006 19:53
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
By: ebiederm on Fri, 08 December 2006 20:57
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
By: ebiederm on Sat, 09 December 2006 07:54
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
By: serue on Mon, 11 December 2006 15:29
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
By: serue on Mon, 11 December 2006 15:56
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
By: ebiederm on Mon, 11 December 2006 19:35
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
By: serue on Mon, 11 December 2006 20:03
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
By: ebiederm on Mon, 11 December 2006 20:34
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
By: serue on Mon, 11 December 2006 22:01
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
By: serue on Wed, 20 December 2006 06:12
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
By: serue on Mon, 11 December 2006 22:18
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
By: ebiederm on Tue, 12 December 2006 03:28
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
By: serue on Tue, 12 December 2006 15:29
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
By: serue on Tue, 12 December 2006 15:45
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
By: dev on Tue, 12 December 2006 08:43
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
By: ebiederm on Tue, 12 December 2006 07:52
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
By: ebiederm on Tue, 12 December 2006 08:37
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
By: ebiederm on Tue, 12 December 2006 08:57
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
By: ebiederm on Wed, 13 December 2006 18:53
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
|
 |
|
Re: [patch -mm 08/17] nsproxy: add hashtable
By: ebiederm on Thu, 14 December 2006 21:08
|
 |
|
[patch -mm 09/17] nsproxy: add namespace flags
|
 |
|
Re: [patch -mm 09/17] nsproxy: add namespace flags
|
 |
|
Re: [patch -mm 09/17] nsproxy: add namespace flags
|
 |
|
Re: [patch -mm 09/17] nsproxy: add namespace flags
By: ebiederm on Fri, 08 December 2006 19:40
|
 |
|
Re: [patch -mm 09/17] nsproxy: add namespace flags
|
 |
|
Re: [patch -mm 09/17] nsproxy: add namespace flags
By: ebiederm on Mon, 11 December 2006 20:02
|
 |
|
[patch -mm 10/17] nsproxy: add unshare_ns and bind_ns syscalls
|
 |
|
Re: [patch -mm 10/17] nsproxy: add unshare_ns and bind_ns syscalls
By: ebiederm on Fri, 08 December 2006 19:26
|
 |
|
Re: [patch -mm 10/17] nsproxy: add unshare_ns and bind_ns syscalls
|
 |
|
Re: [patch -mm 10/17] nsproxy: add unshare_ns and bind_ns syscalls
|
 |
|
Re: [patch -mm 10/17] nsproxy: add unshare_ns and bind_ns syscalls
|
 |
|
Re: [patch -mm 10/17] nsproxy: add unshare_ns and bind_ns syscalls
By: ebiederm on Sat, 09 December 2006 07:40
|
 |
|
Re: [patch -mm 10/17] nsproxy: add unshare_ns and bind_ns syscalls
|
 |
|
[patch -mm 11/17] user namespace: add user_namespace ptr to vfsmount
|
 |
|
Re: [patch -mm 11/17] user namespace: add user_namespace ptr to vfsmount
By: serue on Tue, 05 December 2006 18:27
|
 |
|
[patch -mm 12/17] user namespace: hook permission
|
 |
|
[patch -mm 13/17] user namespace: implement shared mounts
|
 |
|
[patch -mm 14/17] user namespace: maintain user ns for priv_userns mounts to vfsmount
|
 |
|
[patch -mm 15/17] pid namespace: add unshare
|
 |
|
[patch -mm 16/17] net namespace: add unshare
|
 |
|
[patch -mm 17/17] user namespace: add unshare
|
Goto Forum:
Current Time: Sat Jul 19 01:12:41 GMT 2025
Total time taken to generate the page: 0.04074 seconds
|