From: Miklos Szeredi <mszeredi@suse.cz>
1. Only show reachable mounts in /proc/<pid>/mountinfo, this makes
mountpoints unambiguous for chrooted processes.
2. Instead of showing mountpoints relative to the current root, always
show them relative to the queried task's root.
This means, that a particular mountinfo file will always have the same
contents, regardless of which process is reading the file. Which is a
lot more consistent, than the current behavior of /proc/<pid>/mounts.
Addressed comments from Jan Blunck and Ram Pai.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
---
fs/dcache.c | 16 ++++++---
fs/namespace.c | 23 +++++++++-----
fs/pnode.c | 28 ++++++++++++++---
fs/pnode.h | 2 -
fs/proc/base.c | 68 ++++++++++++++++++++++++++----------------
fs/seq_file.c | 25 +++++++++++++++
include/linux/dcache.h | 1
include/linux/mnt_namespace.h | 8 ++++
include/linux/seq_file.h | 2 +
9 files changed, 128 insertions(+), 45 deletions(-)
Index: linux/fs/dcache.c
===================================================================
--- linux.orig/fs/dcache.c 2008-03-13 20:45:52.000000000 +0100
+++ linux/fs/dcache.c 2008-03-13 20:45:53.000000000 +0100
@@ -1760,12 +1760,12 @@ static int prepend(char **buffer, int *b
/**
* d_path - return the path of a dentry
- * @dentry: dentry to report
- * @vfsmnt: vfsmnt to which the dentry belongs
+ * @path: the dentry/vfsmount to report
* @root: root dentry
* @rootmnt: vfsmnt to which the root dentry belongs
* @buffer: buffer to return value in
* @buflen: buffer length
+ * @only_reachable: if true, then path must be reachable from root
*
* Convert a dentry into an ASCII path name. If the entry has been deleted
* the string " (deleted)" is appended. Note that this is ambiguous.
@@ -1774,9 +1774,11 @@ static int prepend(char **buffer, int *b
*
* "buflen" should be ...