From: Miklos Szeredi <firstname.lastname@example.org>
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 <email@example.com>
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(-)
--- 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 ...
Humm... Might make sense to update *root in case we hit that place and
do the rest in callers, instead of playing with extra arguments...
Hell knows, I'd try to massage in that direction and see if anything
*UGH*. Do you really need that? Frankly, in that case I'd rather
Agreed. I did the separate check first, but then there's a window
between the check and __d_path() where the mountpoint might move
outside the root, and trying to prevent that would also add quite a
bit of ugliness.