diff options
Diffstat (limited to 'fs/super.c')
-rw-r--r-- | fs/super.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/fs/super.c b/fs/super.c index 823e061faa87..74e149efed81 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -767,13 +767,13 @@ struct dentry *mount_bdev(struct file_system_type *fs_type, | |||
767 | { | 767 | { |
768 | struct block_device *bdev; | 768 | struct block_device *bdev; |
769 | struct super_block *s; | 769 | struct super_block *s; |
770 | fmode_t mode = FMODE_READ; | 770 | fmode_t mode = FMODE_READ | FMODE_EXCL; |
771 | int error = 0; | 771 | int error = 0; |
772 | 772 | ||
773 | if (!(flags & MS_RDONLY)) | 773 | if (!(flags & MS_RDONLY)) |
774 | mode |= FMODE_WRITE; | 774 | mode |= FMODE_WRITE; |
775 | 775 | ||
776 | bdev = open_bdev_exclusive(dev_name, mode, fs_type); | 776 | bdev = blkdev_get_by_path(dev_name, mode, fs_type); |
777 | if (IS_ERR(bdev)) | 777 | if (IS_ERR(bdev)) |
778 | return ERR_CAST(bdev); | 778 | return ERR_CAST(bdev); |
779 | 779 | ||
@@ -802,13 +802,13 @@ struct dentry *mount_bdev(struct file_system_type *fs_type, | |||
802 | 802 | ||
803 | /* | 803 | /* |
804 | * s_umount nests inside bd_mutex during | 804 | * s_umount nests inside bd_mutex during |
805 | * __invalidate_device(). close_bdev_exclusive() | 805 | * __invalidate_device(). blkdev_put() acquires |
806 | * acquires bd_mutex and can't be called under | 806 | * bd_mutex and can't be called under s_umount. Drop |
807 | * s_umount. Drop s_umount temporarily. This is safe | 807 | * s_umount temporarily. This is safe as we're |
808 | * as we're holding an active reference. | 808 | * holding an active reference. |
809 | */ | 809 | */ |
810 | up_write(&s->s_umount); | 810 | up_write(&s->s_umount); |
811 | close_bdev_exclusive(bdev, mode); | 811 | blkdev_put(bdev, mode); |
812 | down_write(&s->s_umount); | 812 | down_write(&s->s_umount); |
813 | } else { | 813 | } else { |
814 | char b[BDEVNAME_SIZE]; | 814 | char b[BDEVNAME_SIZE]; |
@@ -832,7 +832,7 @@ struct dentry *mount_bdev(struct file_system_type *fs_type, | |||
832 | error_s: | 832 | error_s: |
833 | error = PTR_ERR(s); | 833 | error = PTR_ERR(s); |
834 | error_bdev: | 834 | error_bdev: |
835 | close_bdev_exclusive(bdev, mode); | 835 | blkdev_put(bdev, mode); |
836 | error: | 836 | error: |
837 | return ERR_PTR(error); | 837 | return ERR_PTR(error); |
838 | } | 838 | } |
@@ -863,7 +863,8 @@ void kill_block_super(struct super_block *sb) | |||
863 | bdev->bd_super = NULL; | 863 | bdev->bd_super = NULL; |
864 | generic_shutdown_super(sb); | 864 | generic_shutdown_super(sb); |
865 | sync_blockdev(bdev); | 865 | sync_blockdev(bdev); |
866 | close_bdev_exclusive(bdev, mode); | 866 | WARN_ON_ONCE(!(mode & FMODE_EXCL)); |
867 | blkdev_put(bdev, mode | FMODE_EXCL); | ||
867 | } | 868 | } |
868 | 869 | ||
869 | EXPORT_SYMBOL(kill_block_super); | 870 | EXPORT_SYMBOL(kill_block_super); |
@@ -1140,7 +1141,7 @@ static struct vfsmount *fs_set_subtype(struct vfsmount *mnt, const char *fstype) | |||
1140 | return mnt; | 1141 | return mnt; |
1141 | 1142 | ||
1142 | err: | 1143 | err: |
1143 | mntput_long(mnt); | 1144 | mntput(mnt); |
1144 | return ERR_PTR(err); | 1145 | return ERR_PTR(err); |
1145 | } | 1146 | } |
1146 | 1147 | ||