summaryrefslogtreecommitdiff
path: root/fs/nsfs.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2015-05-24 12:49:04 -0500
committerEric W. Biederman <ebiederm@xmission.com>2015-07-11 11:09:00 -0500
commit75509fd88fbd580c793780b0001c71c3510f2726 (patch)
treebb9f7f285f5db2a50cc7cfc1d87a369c9f7e4314 /fs/nsfs.c
parent77b1a97d218277d55a15016826d1fd79290f1df2 (diff)
downloadlwn-75509fd88fbd580c793780b0001c71c3510f2726.tar.gz
lwn-75509fd88fbd580c793780b0001c71c3510f2726.zip
nsfs: Add a show_path method to fix mountinfo
Today mountinfo displays a very unhelpful "/" for nsfs files. Add a show_path method returning the same string as ns_dname. This results in a bind mount of /proc/<pid>/ns/net showing up in /proc/<pid>/mountinfo as "net:[1234...]" instead of "/". Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'fs/nsfs.c')
-rw-r--r--fs/nsfs.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/nsfs.c b/fs/nsfs.c
index 99521e7c492b..e4905fbf3396 100644
--- a/fs/nsfs.c
+++ b/fs/nsfs.c
@@ -4,6 +4,7 @@
#include <linux/proc_ns.h>
#include <linux/magic.h>
#include <linux/ktime.h>
+#include <linux/seq_file.h>
static struct vfsmount *nsfs_mnt;
@@ -136,9 +137,18 @@ out_invalid:
return ERR_PTR(-EINVAL);
}
+static int nsfs_show_path(struct seq_file *seq, struct dentry *dentry)
+{
+ struct inode *inode = d_inode(dentry);
+ const struct proc_ns_operations *ns_ops = dentry->d_fsdata;
+
+ return seq_printf(seq, "%s:[%lu]", ns_ops->name, inode->i_ino);
+}
+
static const struct super_operations nsfs_ops = {
.statfs = simple_statfs,
.evict_inode = nsfs_evict,
+ .show_path = nsfs_show_path,
};
static struct dentry *nsfs_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data)