changed release number
[linux-2.6.git] / fs / namespace.c
index 9454e3c..5c68a3f 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/namei.h>
 #include <linux/security.h>
 #include <linux/mount.h>
+#include <linux/vs_base.h>
 #include <linux/vserver/namespace.h>
 #include <linux/vserver/xid.h>
 #include <asm/uaccess.h>
@@ -45,9 +46,9 @@ __cacheline_aligned_in_smp DEFINE_SPINLOCK(vfsmount_lock);
 
 static int event;
 
-static struct list_head *mount_hashtable __read_mostly;
+static struct list_head *mount_hashtable;
 static int hash_mask __read_mostly, hash_bits __read_mostly;
-static kmem_cache_t *mnt_cache __read_mostly;
+static kmem_cache_t *mnt_cache;
 static struct rw_semaphore namespace_sem;
 
 /* /sys/fs */
@@ -444,44 +445,6 @@ struct seq_operations mounts_op = {
        .show   = show_vfsmnt
 };
 
-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, ' ');
-
-       /* file system type */
-       seq_puts(m, "with fstype ");
-       mangle(m, mnt->mnt_sb->s_type->name);
-
-       /* optional statistics */
-       if (mnt->mnt_sb->s_op->show_stats) {
-               seq_putc(m, ' ');
-               err = mnt->mnt_sb->s_op->show_stats(m, mnt);
-       }
-
-       seq_putc(m, '\n');
-       return err;
-}
-
-struct seq_operations mountstats_op = {
-       .start  = m_start,
-       .next   = m_next,
-       .stop   = m_stop,
-       .show   = show_vfsstat,
-};
-
 /**
  * may_umount_tree - check if a mount tree is busy
  * @mnt: root of mount tree
@@ -504,9 +467,9 @@ int may_umount_tree(struct vfsmount *mnt)
        spin_unlock(&vfsmount_lock);
 
        if (actual_refs > minimum_refs)
-               return 0;
+               return -EBUSY;
 
-       return 1;
+       return 0;
 }
 
 EXPORT_SYMBOL(may_umount_tree);
@@ -526,10 +489,10 @@ EXPORT_SYMBOL(may_umount_tree);
  */
 int may_umount(struct vfsmount *mnt)
 {
-       int ret = 1;
+       int ret = 0;
        spin_lock(&vfsmount_lock);
        if (propagate_mount_busy(mnt, 2))
-               ret = 0;
+               ret = -EBUSY;
        spin_unlock(&vfsmount_lock);
        return ret;
 }
@@ -558,11 +521,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 +545,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 +1362,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);
@@ -1619,8 +1559,6 @@ void set_fs_root(struct fs_struct *fs, struct vfsmount *mnt,
        }
 }
 
-EXPORT_SYMBOL_GPL(set_fs_root);
-
 /*
  * Replace the fs->{pwdmnt,pwd} with {mnt,dentry}. Put the old values.
  * It can block. Requires the big lock held.