aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc_namespace.c
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2014-12-15 22:59:37 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2014-12-17 08:27:15 -0500
commit9d4d65748a5ca26ea8650e50ba521295549bf4e3 (patch)
tree6ab682d37fb472d76c8593f72168c5c58b1479a1 /fs/proc_namespace.c
parent9ad4dc4f7318080e2e4e0cd23623211a20d33861 (diff)
vfs: make mounts and mountstats honor root dir like mountinfo does
As we already show mountpoints relative to the root directory, thanks to the change made back in 2000, change show_vfsmnt() and show_vfsstat() to skip out-of-root mountpoints the same way as show_mountinfo() does. Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/proc_namespace.c')
-rw-r--r--fs/proc_namespace.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index 789e8d1e21db..0f96f71ab32b 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -91,6 +91,7 @@ static void show_type(struct seq_file *m, struct super_block *sb)
91 91
92static int show_vfsmnt(struct seq_file *m, struct vfsmount *mnt) 92static int show_vfsmnt(struct seq_file *m, struct vfsmount *mnt)
93{ 93{
94 struct proc_mounts *p = proc_mounts(m);
94 struct mount *r = real_mount(mnt); 95 struct mount *r = real_mount(mnt);
95 int err = 0; 96 int err = 0;
96 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt }; 97 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
@@ -104,7 +105,10 @@ static int show_vfsmnt(struct seq_file *m, struct vfsmount *mnt)
104 mangle(m, r->mnt_devname ? r->mnt_devname : "none"); 105 mangle(m, r->mnt_devname ? r->mnt_devname : "none");
105 } 106 }
106 seq_putc(m, ' '); 107 seq_putc(m, ' ');
107 seq_path(m, &mnt_path, " \t\n\\"); 108 /* mountpoints outside of chroot jail will give SEQ_SKIP on this */
109 err = seq_path_root(m, &mnt_path, &p->root, " \t\n\\");
110 if (err)
111 goto out;
108 seq_putc(m, ' '); 112 seq_putc(m, ' ');
109 show_type(m, sb); 113 show_type(m, sb);
110 seq_puts(m, __mnt_is_readonly(mnt) ? " ro" : " rw"); 114 seq_puts(m, __mnt_is_readonly(mnt) ? " ro" : " rw");
@@ -181,6 +185,7 @@ out:
181 185
182static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt) 186static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
183{ 187{
188 struct proc_mounts *p = proc_mounts(m);
184 struct mount *r = real_mount(mnt); 189 struct mount *r = real_mount(mnt);
185 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt }; 190 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
186 struct super_block *sb = mnt_path.dentry->d_sb; 191 struct super_block *sb = mnt_path.dentry->d_sb;
@@ -200,7 +205,10 @@ static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
200 205
201 /* mount point */ 206 /* mount point */
202 seq_puts(m, " mounted on "); 207 seq_puts(m, " mounted on ");
203 seq_path(m, &mnt_path, " \t\n\\"); 208 /* mountpoints outside of chroot jail will give SEQ_SKIP on this */
209 err = seq_path_root(m, &mnt_path, &p->root, " \t\n\\");
210 if (err)
211 goto out;
204 seq_putc(m, ' '); 212 seq_putc(m, ' ');
205 213
206 /* file system type */ 214 /* file system type */
@@ -215,6 +223,7 @@ static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
215 } 223 }
216 224
217 seq_putc(m, '\n'); 225 seq_putc(m, '\n');
226out:
218 return err; 227 return err;
219} 228}
220 229