diff options
Diffstat (limited to 'fs/super.c')
-rw-r--r-- | fs/super.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/super.c b/fs/super.c index e20b5580afd5..a66f66bb8049 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/writeback.h> /* for the emergency remount stuff */ | 37 | #include <linux/writeback.h> /* for the emergency remount stuff */ |
38 | #include <linux/idr.h> | 38 | #include <linux/idr.h> |
39 | #include <linux/kobject.h> | 39 | #include <linux/kobject.h> |
40 | #include <linux/mutex.h> | ||
40 | #include <asm/uaccess.h> | 41 | #include <asm/uaccess.h> |
41 | 42 | ||
42 | 43 | ||
@@ -55,11 +56,10 @@ DEFINE_SPINLOCK(sb_lock); | |||
55 | */ | 56 | */ |
56 | static struct super_block *alloc_super(void) | 57 | static struct super_block *alloc_super(void) |
57 | { | 58 | { |
58 | struct super_block *s = kmalloc(sizeof(struct super_block), GFP_USER); | 59 | struct super_block *s = kzalloc(sizeof(struct super_block), GFP_USER); |
59 | static struct super_operations default_op; | 60 | static struct super_operations default_op; |
60 | 61 | ||
61 | if (s) { | 62 | if (s) { |
62 | memset(s, 0, sizeof(struct super_block)); | ||
63 | if (security_sb_alloc(s)) { | 63 | if (security_sb_alloc(s)) { |
64 | kfree(s); | 64 | kfree(s); |
65 | s = NULL; | 65 | s = NULL; |
@@ -76,9 +76,9 @@ static struct super_block *alloc_super(void) | |||
76 | down_write(&s->s_umount); | 76 | down_write(&s->s_umount); |
77 | s->s_count = S_BIAS; | 77 | s->s_count = S_BIAS; |
78 | atomic_set(&s->s_active, 1); | 78 | atomic_set(&s->s_active, 1); |
79 | sema_init(&s->s_vfs_rename_sem,1); | 79 | mutex_init(&s->s_vfs_rename_mutex); |
80 | sema_init(&s->s_dquot.dqio_sem, 1); | 80 | mutex_init(&s->s_dquot.dqio_mutex); |
81 | sema_init(&s->s_dquot.dqonoff_sem, 1); | 81 | mutex_init(&s->s_dquot.dqonoff_mutex); |
82 | init_rwsem(&s->s_dquot.dqptr_sem); | 82 | init_rwsem(&s->s_dquot.dqptr_sem); |
83 | init_waitqueue_head(&s->s_wait_unfrozen); | 83 | init_waitqueue_head(&s->s_wait_unfrozen); |
84 | s->s_maxbytes = MAX_NON_LFS; | 84 | s->s_maxbytes = MAX_NON_LFS; |
@@ -381,9 +381,9 @@ restart: | |||
381 | void sync_filesystems(int wait) | 381 | void sync_filesystems(int wait) |
382 | { | 382 | { |
383 | struct super_block *sb; | 383 | struct super_block *sb; |
384 | static DECLARE_MUTEX(mutex); | 384 | static DEFINE_MUTEX(mutex); |
385 | 385 | ||
386 | down(&mutex); /* Could be down_interruptible */ | 386 | mutex_lock(&mutex); /* Could be down_interruptible */ |
387 | spin_lock(&sb_lock); | 387 | spin_lock(&sb_lock); |
388 | list_for_each_entry(sb, &super_blocks, s_list) { | 388 | list_for_each_entry(sb, &super_blocks, s_list) { |
389 | if (!sb->s_op->sync_fs) | 389 | if (!sb->s_op->sync_fs) |
@@ -412,7 +412,7 @@ restart: | |||
412 | goto restart; | 412 | goto restart; |
413 | } | 413 | } |
414 | spin_unlock(&sb_lock); | 414 | spin_unlock(&sb_lock); |
415 | up(&mutex); | 415 | mutex_unlock(&mutex); |
416 | } | 416 | } |
417 | 417 | ||
418 | /** | 418 | /** |
@@ -693,9 +693,9 @@ struct super_block *get_sb_bdev(struct file_system_type *fs_type, | |||
693 | * will protect the lockfs code from trying to start a snapshot | 693 | * will protect the lockfs code from trying to start a snapshot |
694 | * while we are mounting | 694 | * while we are mounting |
695 | */ | 695 | */ |
696 | down(&bdev->bd_mount_sem); | 696 | mutex_lock(&bdev->bd_mount_mutex); |
697 | s = sget(fs_type, test_bdev_super, set_bdev_super, bdev); | 697 | s = sget(fs_type, test_bdev_super, set_bdev_super, bdev); |
698 | up(&bdev->bd_mount_sem); | 698 | mutex_unlock(&bdev->bd_mount_mutex); |
699 | if (IS_ERR(s)) | 699 | if (IS_ERR(s)) |
700 | goto out; | 700 | goto out; |
701 | 701 | ||
@@ -712,7 +712,7 @@ struct super_block *get_sb_bdev(struct file_system_type *fs_type, | |||
712 | s->s_flags = flags; | 712 | s->s_flags = flags; |
713 | strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); | 713 | strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); |
714 | sb_set_blocksize(s, block_size(bdev)); | 714 | sb_set_blocksize(s, block_size(bdev)); |
715 | error = fill_super(s, data, flags & MS_VERBOSE ? 1 : 0); | 715 | error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); |
716 | if (error) { | 716 | if (error) { |
717 | up_write(&s->s_umount); | 717 | up_write(&s->s_umount); |
718 | deactivate_super(s); | 718 | deactivate_super(s); |
@@ -756,7 +756,7 @@ struct super_block *get_sb_nodev(struct file_system_type *fs_type, | |||
756 | 756 | ||
757 | s->s_flags = flags; | 757 | s->s_flags = flags; |
758 | 758 | ||
759 | error = fill_super(s, data, flags & MS_VERBOSE ? 1 : 0); | 759 | error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); |
760 | if (error) { | 760 | if (error) { |
761 | up_write(&s->s_umount); | 761 | up_write(&s->s_umount); |
762 | deactivate_super(s); | 762 | deactivate_super(s); |
@@ -785,7 +785,7 @@ struct super_block *get_sb_single(struct file_system_type *fs_type, | |||
785 | return s; | 785 | return s; |
786 | if (!s->s_root) { | 786 | if (!s->s_root) { |
787 | s->s_flags = flags; | 787 | s->s_flags = flags; |
788 | error = fill_super(s, data, flags & MS_VERBOSE ? 1 : 0); | 788 | error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); |
789 | if (error) { | 789 | if (error) { |
790 | up_write(&s->s_umount); | 790 | up_write(&s->s_umount); |
791 | deactivate_super(s); | 791 | deactivate_super(s); |