Merge to Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.13-vs2...
[linux-2.6.git] / fs / namespace.c
index 9454e3c..03f43da 100644 (file)
@@ -449,17 +449,27 @@ static int show_vfsstat(struct seq_file *m, void *v)
        struct vfsmount *mnt = v;
        int err = 0;
 
-       /* device */
-       if (mnt->mnt_devname) {
-               seq_puts(m, "device ");
-               mangle(m, mnt->mnt_devname);
-       } else
-               seq_puts(m, "no device");
-
-       /* mount point */
-       seq_puts(m, " mounted on ");
-       seq_path(m, mnt, mnt->mnt_root, " \t\n\\");
-       seq_putc(m, ' ');
+       if (vx_flags(VXF_HIDE_MOUNT, 0))
+               return 0;
+       if (!mnt_is_reachable(mnt) && !vx_check(0, VX_WATCH))
+               return 0;
+
+       if (!vx_check(0, VX_ADMIN|VX_WATCH) &&
+               mnt == current->fs->rootmnt) {
+               seq_puts(m, "device /dev/root mounted on / ");
+       } else {
+               /* device */
+               if (mnt->mnt_devname) {
+                       seq_puts(m, "device ");
+                       mangle(m, mnt->mnt_devname);
+               } else
+                       seq_puts(m, "no device");
+
+               /* mount point */
+               seq_puts(m, " mounted on ");
+               seq_path(m, mnt, mnt->mnt_root, " \t\n\\");
+               seq_putc(m, ' ');
+       }
 
        /* file system type */
        seq_puts(m, "with fstype ");
@@ -558,11 +568,15 @@ void release_mounts(struct list_head *head)
        }
 }
 
-static inline void __umount_list(struct vfsmount *mnt,
-       int propagate, struct list_head *kill)
+void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill)
 {
        struct vfsmount *p;
 
+       for (p = mnt; p; p = next_mnt(p, mnt)) {
+               list_del(&p->mnt_hash);
+               list_add(&p->mnt_hash, kill);
+       }
+
        if (propagate)
                propagate_umount(kill);
 
@@ -578,33 +592,6 @@ static inline void __umount_list(struct vfsmount *mnt,
        }
 }
 
-void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill)
-{
-       struct vfsmount *p;
-
-       for (p = mnt; p; p = next_mnt(p, mnt)) {
-               list_del(&p->mnt_hash);
-               list_add(&p->mnt_hash, kill);
-               // p->mnt_namespace = NULL;
-       }
-       __umount_list(mnt, propagate, kill);
-}
-
-void umount_unused(struct vfsmount *mnt, struct fs_struct *fs)
-{
-       struct vfsmount *p;
-       LIST_HEAD(kill);
-
-       for (p = mnt; p; p = next_mnt(p, mnt)) {
-               if (p == fs->rootmnt || p == fs->pwdmnt)
-                       continue;
-               list_del(&p->mnt_list);
-               list_add(&p->mnt_list, &kill);
-               p->mnt_namespace = NULL;
-       }
-       __umount_list(mnt, 0, &kill);
-}
-
 static int do_umount(struct vfsmount *mnt, int flags)
 {
        struct super_block *sb = mnt->mnt_sb;
@@ -1422,7 +1409,7 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
        if (flags & MS_NODIRATIME)
                mnt_flags |= MNT_NODIRATIME;
 
-       if (vx_ccaps(VXC_SECURE_MOUNT))
+       if (!capable(CAP_SYS_ADMIN))
                mnt_flags |= MNT_NODEV;
        flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE |
                   MS_NOATIME | MS_NODIRATIME);