mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									9ad4dc4f73
								
							
						
					
					
						commit
						9d4d65748a
					
				
					 1 changed files with 11 additions and 2 deletions
				
			
		|  | @ -91,6 +91,7 @@ static void show_type(struct seq_file *m, struct super_block *sb) | |||
| 
 | ||||
| static int show_vfsmnt(struct seq_file *m, struct vfsmount *mnt) | ||||
| { | ||||
| 	struct proc_mounts *p = proc_mounts(m); | ||||
| 	struct mount *r = real_mount(mnt); | ||||
| 	int err = 0; | ||||
| 	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) | |||
| 		mangle(m, r->mnt_devname ? r->mnt_devname : "none"); | ||||
| 	} | ||||
| 	seq_putc(m, ' '); | ||||
| 	seq_path(m, &mnt_path, " \t\n\\"); | ||||
| 	/* mountpoints outside of chroot jail will give SEQ_SKIP on this */ | ||||
| 	err = seq_path_root(m, &mnt_path, &p->root, " \t\n\\"); | ||||
| 	if (err) | ||||
| 		goto out; | ||||
| 	seq_putc(m, ' '); | ||||
| 	show_type(m, sb); | ||||
| 	seq_puts(m, __mnt_is_readonly(mnt) ? " ro" : " rw"); | ||||
|  | @ -181,6 +185,7 @@ static int show_mountinfo(struct seq_file *m, struct vfsmount *mnt) | |||
| 
 | ||||
| static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt) | ||||
| { | ||||
| 	struct proc_mounts *p = proc_mounts(m); | ||||
| 	struct mount *r = real_mount(mnt); | ||||
| 	struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt }; | ||||
| 	struct super_block *sb = mnt_path.dentry->d_sb; | ||||
|  | @ -200,7 +205,10 @@ static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt) | |||
| 
 | ||||
| 	/* mount point */ | ||||
| 	seq_puts(m, " mounted on "); | ||||
| 	seq_path(m, &mnt_path, " \t\n\\"); | ||||
| 	/* mountpoints outside of chroot jail will give SEQ_SKIP on this */ | ||||
| 	err = seq_path_root(m, &mnt_path, &p->root, " \t\n\\"); | ||||
| 	if (err) | ||||
| 		goto out; | ||||
| 	seq_putc(m, ' '); | ||||
| 
 | ||||
| 	/* file system type */ | ||||
|  | @ -215,6 +223,7 @@ static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt) | |||
| 	} | ||||
| 
 | ||||
| 	seq_putc(m, '\n'); | ||||
| out: | ||||
| 	return err; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Dmitry V. Levin
						Dmitry V. Levin