diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2015-05-24 13:49:04 -0400 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2015-07-11 12:09:00 -0400 |
commit | 75509fd88fbd580c793780b0001c71c3510f2726 (patch) | |
tree | bb9f7f285f5db2a50cc7cfc1d87a369c9f7e4314 | |
parent | 77b1a97d218277d55a15016826d1fd79290f1df2 (diff) |
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>
-rw-r--r-- | fs/nsfs.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/proc_ns.h> | 4 | #include <linux/proc_ns.h> |
5 | #include <linux/magic.h> | 5 | #include <linux/magic.h> |
6 | #include <linux/ktime.h> | 6 | #include <linux/ktime.h> |
7 | #include <linux/seq_file.h> | ||
7 | 8 | ||
8 | static struct vfsmount *nsfs_mnt; | 9 | static struct vfsmount *nsfs_mnt; |
9 | 10 | ||
@@ -136,9 +137,18 @@ out_invalid: | |||
136 | return ERR_PTR(-EINVAL); | 137 | return ERR_PTR(-EINVAL); |
137 | } | 138 | } |
138 | 139 | ||
140 | static int nsfs_show_path(struct seq_file *seq, struct dentry *dentry) | ||
141 | { | ||
142 | struct inode *inode = d_inode(dentry); | ||
143 | const struct proc_ns_operations *ns_ops = dentry->d_fsdata; | ||
144 | |||
145 | return seq_printf(seq, "%s:[%lu]", ns_ops->name, inode->i_ino); | ||
146 | } | ||
147 | |||
139 | static const struct super_operations nsfs_ops = { | 148 | static const struct super_operations nsfs_ops = { |
140 | .statfs = simple_statfs, | 149 | .statfs = simple_statfs, |
141 | .evict_inode = nsfs_evict, | 150 | .evict_inode = nsfs_evict, |
151 | .show_path = nsfs_show_path, | ||
142 | }; | 152 | }; |
143 | static struct dentry *nsfs_mount(struct file_system_type *fs_type, | 153 | static struct dentry *nsfs_mount(struct file_system_type *fs_type, |
144 | int flags, const char *dev_name, void *data) | 154 | int flags, const char *dev_name, void *data) |