diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-10-19 02:40:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-19 14:53:40 -0400 |
commit | 6f4e643353aea52d80f33960bd88954a7c074f0f (patch) | |
tree | 5b7e452f7e31be89f06a52a2c077183b7fe74c3b /include | |
parent | 130f77ecb2e7d5ac3e53e620f55e374f4a406b20 (diff) |
pid namespaces: initialize the namespace's proc_mnt
The namespace's proc_mnt must be kern_mount-ed to make this pointer always
valid, independently of whether the user space mounted the proc or not. This
solves raced in proc_flush_task, etc. with the proc_mnt switching from NULL
to not-NULL.
The initialization is done after the init's pid is created and hashed to make
proc_get_sb() finr it and get for root inode.
Sice the namespace holds the vfsmnt, vfsmnt holds the superblock and the
superblock holds the namespace we must explicitly break this circle to destroy
all the stuff. This is done after the init of the namespace dies. Running a
few steps forward - when init exits it will kill all its children, so no
proc_mnt will be needed after its death.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Cc: Paul Menage <menage@google.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/proc_fs.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index cbc1038c7900..1ff461672060 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
@@ -143,6 +143,9 @@ extern const struct file_operations proc_kcore_operations; | |||
143 | extern const struct file_operations proc_kmsg_operations; | 143 | extern const struct file_operations proc_kmsg_operations; |
144 | extern const struct file_operations ppc_htab_operations; | 144 | extern const struct file_operations ppc_htab_operations; |
145 | 145 | ||
146 | extern int pid_ns_prepare_proc(struct pid_namespace *ns); | ||
147 | extern void pid_ns_release_proc(struct pid_namespace *ns); | ||
148 | |||
146 | /* | 149 | /* |
147 | * proc_tty.c | 150 | * proc_tty.c |
148 | */ | 151 | */ |
@@ -235,6 +238,15 @@ static inline void proc_tty_unregister_driver(struct tty_driver *driver) {}; | |||
235 | 238 | ||
236 | extern struct proc_dir_entry proc_root; | 239 | extern struct proc_dir_entry proc_root; |
237 | 240 | ||
241 | static inline int pid_ns_prepare_proc(struct pid_namespace *ns) | ||
242 | { | ||
243 | return 0; | ||
244 | } | ||
245 | |||
246 | static inline void pid_ns_release_proc(struct pid_namespace *ns) | ||
247 | { | ||
248 | } | ||
249 | |||
238 | #endif /* CONFIG_PROC_FS */ | 250 | #endif /* CONFIG_PROC_FS */ |
239 | 251 | ||
240 | #if !defined(CONFIG_PROC_KCORE) | 252 | #if !defined(CONFIG_PROC_KCORE) |