Re: [PATCH 2/2] vfs: show unreachable paths in getcwd and proc

From: Nick Piggin
Date: Tue Jun 15 2010 - 04:18:39 EST


On Fri, Jun 04, 2010 at 01:53:42PM +0200, Miklos Szeredi wrote:
> From: Miklos Szeredi <mszeredi@xxxxxxx>
>
> Prepend "(unreachable)" to path strings if the path is not reachable
> from the current root.
>
> Two places updated are
> - the return string from getcwd()
> - and symlinks under /proc/$PID.
>
> Other uses of d_path() are left unchanged (we know that some old
> software crashes if /proc/mounts is changed).
>
> Signed-off-by: Miklos Szeredi <mszeredi@xxxxxxx>
> ---
> fs/dcache.c | 82 +++++++++++++++++++++++++++++++++++++++++--------
> fs/proc/base.c | 2 -
> include/linux/dcache.h | 1
> 3 files changed, 72 insertions(+), 13 deletions(-)
>
> Index: linux-2.6/fs/dcache.c
> ===================================================================
> --- linux-2.6.orig/fs/dcache.c 2010-05-27 12:22:21.000000000 +0200
> +++ linux-2.6/fs/dcache.c 2010-05-27 12:22:24.000000000 +0200
> @@ -1957,6 +1957,33 @@ int __d_path(const struct path *path, st
> return error;
> }
>
> +static void current_root(struct path *root)
> +{
> + read_lock(&current->fs->lock);
> + *root = current->fs->root;
> + path_get(root);
> + read_unlock(&current->fs->lock);
> +}

Does this really need a helper? If yes, then please put matching
get_fs_{root,pwd,both} helpers into fs_struct.c and use them throughout
the tree.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/