diff -NurpP --minimal a/fs/namespace.c b/fs/namespace.c --- a/fs/namespace.c 2005-03-09 13:43:26.000000000 +0100 +++ b/fs/namespace.c 2005-03-11 08:28:20.000000000 +0100 @@ -219,6 +219,34 @@ static inline void mangle(struct seq_fil seq_escape(m, s, " \t\n\\"); } +static int mnt_is_reachable(struct vfsmount *mnt) +{ + struct vfsmount *root_mnt; + struct dentry *root, *point; + int ret; + + if (!mnt) + return 1; + if (mnt == mnt->mnt_namespace->root) + return 1; + + spin_lock(&dcache_lock); + root_mnt = current->fs->rootmnt; + root = current->fs->root; + point = root; + + while ((mnt != mnt->mnt_parent) && (mnt != root_mnt)) { + point = mnt->mnt_mountpoint; + mnt = mnt->mnt_parent; + } + + ret = (mnt == root_mnt) && is_subdir(point, root); + + spin_unlock(&dcache_lock); + + return ret; +} + static int show_vfsmnt(struct seq_file *m, void *v) { struct vfsmount *mnt = v; @@ -245,13 +273,17 @@ static int show_vfsmnt(struct seq_file * if (vx_flags(VXF_HIDE_MOUNT, 0)) return 0; - if (!vx_check_vfsmount(current->vx_info, mnt)) + if (!mnt_is_reachable(mnt)) return 0; - mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none"); - seq_putc(m, ' '); - seq_path(m, mnt, mnt->mnt_root, " \t\n\\"); - seq_putc(m, ' '); + if (current->xid && mnt == current->fs->rootmnt) { + seq_puts(m, "/dev/root / "); + } else { + mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none"); + seq_putc(m, ' '); + seq_path(m, mnt, mnt->mnt_root, " \t\n\\"); + seq_putc(m, ' '); + } mangle(m, mnt->mnt_sb->s_type->name); seq_puts(m, mnt->mnt_sb->s_flags & MS_RDONLY ? " ro" : " rw"); for (fs_infop = fs_info; fs_infop->flag; fs_infop++) { diff -NurpP --minimal a/include/linux/vserver/namespace.h b/include/linux/vserver/namespace.h --- a/include/linux/vserver/namespace.h 2005-03-09 13:43:26.000000000 +0100 +++ b/include/linux/vserver/namespace.h 2005-03-10 20:46:12.000000000 +0100 @@ -46,8 +46,6 @@ struct namespace; struct fs_struct; struct vfsmount; -extern int vx_check_vfsmount(struct vx_info *, struct vfsmount *); - extern int vx_set_namespace(struct vx_info *, struct namespace *, struct fs_struct *); extern int vc_enter_namespace(uint32_t, void __user *); diff -NurpP --minimal a/kernel/vserver/namespace.c b/kernel/vserver/namespace.c --- a/kernel/vserver/namespace.c 2005-03-09 13:43:26.000000000 +0100 +++ b/kernel/vserver/namespace.c 2005-03-10 20:46:01.000000000 +0100 @@ -23,51 +23,6 @@ #include -int vx_check_vfsmount(struct vx_info *vxi, struct vfsmount *mnt) -{ - struct vfsmount *root_mnt, *altroot_mnt; - struct dentry *root, *altroot, *point; - int r1, r2, s1, s2, ret = 0; - - if (!vxi || !mnt) - return 1; - - spin_lock(&dcache_lock); - altroot_mnt = current->fs->rootmnt; - altroot = current->fs->root; - point = altroot; - - if (vxi->vx_fs) { - root_mnt = vxi->vx_fs->rootmnt; - root = vxi->vx_fs->root; - } else { - root_mnt = altroot_mnt; - root = altroot; - } - /* printk("··· %p:%p/%p:%p ", - root_mnt, root, altroot_mnt, altroot); */ - - while ((mnt != mnt->mnt_parent) && - (mnt != root_mnt) && (mnt != altroot_mnt)) { - point = mnt->mnt_mountpoint; - mnt = mnt->mnt_parent; - } - - r1 = (mnt == root_mnt); - s1 = is_subdir(point, root); - r2 = (mnt == altroot_mnt); - s2 = is_subdir(point, altroot); - - ret = (((mnt == root_mnt) && is_subdir(point, root)) || - ((mnt == altroot_mnt) && is_subdir(point, altroot))); - /* printk("··· for %p:%p -> %d:%d/%d:%d = %d\n", - mnt, point, r1, s1, r2, s2, ret); */ - spin_unlock(&dcache_lock); - - return (r2 && s2); -} - - /* virtual host info names */ static char * vx_vhi_name(struct vx_info *vxi, int id)