upgrade to fedora-2.6.12-1.1398.FC4 + vserver 2.0.rc7
[linux-2.6.git] / fs / super.c
index 035abec..7d5aba0 100644 (file)
@@ -49,7 +49,7 @@ void put_filesystem(struct file_system_type *fs);
 struct file_system_type *get_fs_type(const char *name);
 
 LIST_HEAD(super_blocks);
-spinlock_t sb_lock = SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(sb_lock);
 
 /**
  *     alloc_super     -       create new superblock
@@ -74,6 +74,7 @@ static struct super_block *alloc_super(void)
                INIT_LIST_HEAD(&s->s_files);
                INIT_LIST_HEAD(&s->s_instances);
                INIT_HLIST_HEAD(&s->s_anon);
+               INIT_LIST_HEAD(&s->s_inodes);
                init_rwsem(&s->s_umount);
                sema_init(&s->s_lock, 1);
                down_write(&s->s_umount);
@@ -88,6 +89,7 @@ static struct super_block *alloc_super(void)
                s->dq_op = sb_dquot_ops;
                s->s_qcop = sb_quotactl_ops;
                s->s_op = &default_op;
+               s->s_time_gran = 1000000000;
        }
 out:
        return s;
@@ -145,7 +147,7 @@ int __put_super_and_need_restart(struct super_block *sb)
 
 /**
  *     put_super       -       drop a temporary reference to superblock
- *     @s: superblock in question
+ *     @sb: superblock in question
  *
  *     Drops a temporary reference, frees superblock if there's no
  *     references left.
@@ -236,10 +238,10 @@ void generic_shutdown_super(struct super_block *sb)
                dput(root);
                fsync_super(sb);
                lock_super(sb);
-               lock_kernel();
                sb->s_flags &= ~MS_ACTIVE;
                /* bad name - it should be evict_inodes() */
                invalidate_inodes(sb);
+               lock_kernel();
 
                if (sop->write_super && sb->s_dirt)
                        sop->write_super(sb);
@@ -592,7 +594,7 @@ void emergency_remount(void)
  */
 
 static struct idr unnamed_dev_idr;
-static spinlock_t unnamed_dev_lock = SPIN_LOCK_UNLOCKED;/* protects the above */
+static DEFINE_SPINLOCK(unnamed_dev_lock);/* protects the above */
 
 int set_anon_super(struct super_block *s, void *data)
 {
@@ -734,7 +736,7 @@ void kill_block_super(struct super_block *sb)
 
        bdev_uevent(bdev, KOBJ_UMOUNT);
        generic_shutdown_super(sb);
-       set_blocksize(bdev, sb->s_old_blocksize);
+       sync_blockdev(bdev);
        close_bdev_excl(bdev);
 }
 
@@ -799,7 +801,7 @@ struct vfsmount *
 do_kern_mount(const char *fstype, int flags, const char *name, void *data)
 {
        struct file_system_type *type = get_fs_type(fstype);
-       struct super_block *sb = ERR_PTR(-ENOMEM);
+       struct super_block *sb;
        struct vfsmount *mnt;
        int error;
        char *secdata = NULL;
@@ -807,6 +809,12 @@ do_kern_mount(const char *fstype, int flags, const char *name, void *data)
        if (!type)
                return ERR_PTR(-ENODEV);
 
+       sb = ERR_PTR(-EPERM);
+       if ((type->fs_flags & FS_BINARY_MOUNTDATA) &&
+               !capable(CAP_SYS_ADMIN) && !vx_ccaps(VXC_BINARY_MOUNT))
+               goto out;
+
+       sb = ERR_PTR(-ENOMEM);
        mnt = alloc_vfsmnt(name);
        if (!mnt)
                goto out;