summaryrefslogtreecommitdiff
path: root/fs/nsfs.c
diff options
context:
space:
mode:
authorAndrey Vagin <avagin@openvz.org>2016-09-06 00:47:15 -0700
committerEric W. Biederman <ebiederm@xmission.com>2016-09-22 19:59:41 -0500
commita7306ed8d94af729ecef8b6e37506a1c6fc14788 (patch)
tree0d45320911d2a339bc0abd6bacd5703c7308c08c /fs/nsfs.c
parent6786741dbf99e44fb0c0ed85a37582b8a26f1c3b (diff)
nsfs: add ioctl to get a parent namespace
Pid and user namepaces are hierarchical. There is no way to discover parent-child relationships. In a future we will use this interface to dump and restore nested namespaces. Acked-by: Serge Hallyn <serge@hallyn.com> Signed-off-by: Andrei Vagin <avagin@openvz.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'fs/nsfs.c')
-rw-r--r--fs/nsfs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/nsfs.c b/fs/nsfs.c
index 3887da470f7e..fb7b397a1297 100644
--- a/fs/nsfs.c
+++ b/fs/nsfs.c
@@ -171,6 +171,10 @@ static long ns_ioctl(struct file *filp, unsigned int ioctl,
switch (ioctl) {
case NS_GET_USERNS:
return open_related_ns(ns, ns_get_owner);
+ case NS_GET_PARENT:
+ if (!ns->ops->get_parent)
+ return -EINVAL;
+ return open_related_ns(ns, ns->ops->get_parent);
default:
return -ENOTTY;
}