Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

time: support ns lookup

Support the generic ns lookup infrastructure to support file handles for
namespaces.

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Christian Brauner <brauner@kernel.org>

+17 -1
+5
include/linux/time_namespace.h
··· 33 33 extern struct time_namespace init_time_ns; 34 34 35 35 #ifdef CONFIG_TIME_NS 36 + void __init time_ns_init(void); 36 37 extern int vdso_join_timens(struct task_struct *task, 37 38 struct time_namespace *ns); 38 39 extern void timens_commit(struct task_struct *tsk, struct time_namespace *ns); ··· 109 108 } 110 109 111 110 #else 111 + static inline void __init time_ns_init(void) 112 + { 113 + } 114 + 112 115 static inline int vdso_join_timens(struct task_struct *task, 113 116 struct time_namespace *ns) 114 117 {
+2
init/main.c
··· 103 103 #include <linux/randomize_kstack.h> 104 104 #include <linux/pidfs.h> 105 105 #include <linux/ptdump.h> 106 + #include <linux/time_namespace.h> 106 107 #include <net/net_namespace.h> 107 108 108 109 #include <asm/io.h> ··· 1073 1072 fork_init(); 1074 1073 proc_caches_init(); 1075 1074 uts_ns_init(); 1075 + time_ns_init(); 1076 1076 key_init(); 1077 1077 security_init(); 1078 1078 dbg_late_init();
+10 -1
kernel/time/namespace.c
··· 12 12 #include <linux/seq_file.h> 13 13 #include <linux/proc_ns.h> 14 14 #include <linux/export.h> 15 + #include <linux/nstree.h> 15 16 #include <linux/time.h> 16 17 #include <linux/slab.h> 17 18 #include <linux/cred.h> ··· 105 104 ns->user_ns = get_user_ns(user_ns); 106 105 ns->offsets = old_ns->offsets; 107 106 ns->frozen_offsets = false; 107 + ns_tree_add(ns); 108 108 return ns; 109 109 110 110 fail_free_page: ··· 252 250 253 251 void free_time_ns(struct time_namespace *ns) 254 252 { 253 + ns_tree_remove(ns); 255 254 dec_time_namespaces(ns->ucounts); 256 255 put_user_ns(ns->user_ns); 257 256 ns_free_inum(&ns->ns); 258 257 __free_page(ns->vvar_page); 259 - kfree(ns); 258 + /* Concurrent nstree traversal depends on a grace period. */ 259 + kfree_rcu(ns, ns.ns_rcu); 260 260 } 261 261 262 262 static struct time_namespace *to_time_ns(struct ns_common *ns) ··· 491 487 .ns.ops = &timens_operations, 492 488 .frozen_offsets = true, 493 489 }; 490 + 491 + void __init time_ns_init(void) 492 + { 493 + ns_tree_add(&init_time_ns); 494 + }