diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2010-03-07 18:49:36 -0800 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2012-11-19 05:59:18 -0800 |
commit | 8823c079ba7136dc1948d6f6dcb5f8022bde438e (patch) | |
tree | 2b27b0a046d453c95c1b0490c0650ea586ef0f86 /fs/mount.h | |
parent | a85fb273c94648cbf20a5f9bcf8bbbb075f271ad (diff) | |
download | linux-rt-8823c079ba7136dc1948d6f6dcb5f8022bde438e.tar.gz |
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 'fs/mount.h')
-rw-r--r-- | fs/mount.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/mount.h b/fs/mount.h index 4f291f9de641..e9c37dd3d00d 100644 --- a/fs/mount.h +++ b/fs/mount.h @@ -6,6 +6,7 @@ struct mnt_namespace { atomic_t count; struct mount * root; struct list_head list; + u64 seq; /* Sequence number to prevent loops */ wait_queue_head_t poll; int event; }; |