aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/proc_fs.h
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2010-03-07 21:49:36 -0500
committerEric W. Biederman <ebiederm@xmission.com>2012-11-19 08:59:18 -0500
commit8823c079ba7136dc1948d6f6dcb5f8022bde438e (patch)
tree2b27b0a046d453c95c1b0490c0650ea586ef0f86 /include/linux/proc_fs.h
parenta85fb273c94648cbf20a5f9bcf8bbbb075f271ad (diff)
vfs: Add setns support for the mount namespace
setns support for the mount namespace is a little tricky as an arbitrary decision must be made about what to set fs->root and fs->pwd to, as there is no expectation of a relationship between the two mount namespaces. Therefore I arbitrarily find the root mount point, and follow every mount on top of it to find the top of the mount stack. Then I set fs->root and fs->pwd to that location. The topmost root of the mount stack seems like a reasonable place to be. Bind mount support for the mount namespace inodes has the possibility of creating circular dependencies between mount namespaces. Circular dependencies can result in loops that prevent mount namespaces from every being freed. I avoid creating those circular dependencies by adding a sequence number to the mount namespace and require all bind mounts be of a younger mount namespace into an older mount namespace. Add a helper function proc_ns_inode so it is possible to detect when we are attempting to bind mound a namespace inode. Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'include/linux/proc_fs.h')
-rw-r--r--include/linux/proc_fs.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index acaafcd40aa..9014c041e75 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -174,6 +174,7 @@ extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
174 struct proc_dir_entry *parent); 174 struct proc_dir_entry *parent);
175 175
176extern struct file *proc_ns_fget(int fd); 176extern struct file *proc_ns_fget(int fd);
177extern bool proc_ns_inode(struct inode *inode);
177 178
178#else 179#else
179 180
@@ -229,6 +230,11 @@ static inline struct file *proc_ns_fget(int fd)
229 return ERR_PTR(-EINVAL); 230 return ERR_PTR(-EINVAL);
230} 231}
231 232
233static inline bool proc_ns_inode(struct inode *inode)
234{
235 return false;
236}
237
232#endif /* CONFIG_PROC_FS */ 238#endif /* CONFIG_PROC_FS */
233 239
234#if !defined(CONFIG_PROC_KCORE) 240#if !defined(CONFIG_PROC_KCORE)
@@ -252,6 +258,7 @@ extern const struct proc_ns_operations netns_operations;
252extern const struct proc_ns_operations utsns_operations; 258extern const struct proc_ns_operations utsns_operations;
253extern const struct proc_ns_operations ipcns_operations; 259extern const struct proc_ns_operations ipcns_operations;
254extern const struct proc_ns_operations pidns_operations; 260extern const struct proc_ns_operations pidns_operations;
261extern const struct proc_ns_operations mntns_operations;
255 262
256union proc_op { 263union proc_op {
257 int (*proc_get_link)(struct dentry *, struct path *); 264 int (*proc_get_link)(struct dentry *, struct path *);