diff options
Diffstat (limited to 'fs/super.c')
-rw-r--r-- | fs/super.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/super.c b/fs/super.c index 22374bf0ba87..5d9a4497849a 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -766,13 +766,13 @@ struct dentry *mount_bdev(struct file_system_type *fs_type, | |||
766 | { | 766 | { |
767 | struct block_device *bdev; | 767 | struct block_device *bdev; |
768 | struct super_block *s; | 768 | struct super_block *s; |
769 | fmode_t mode = FMODE_READ; | 769 | fmode_t mode = FMODE_READ | FMODE_EXCL; |
770 | int error = 0; | 770 | int error = 0; |
771 | 771 | ||
772 | if (!(flags & MS_RDONLY)) | 772 | if (!(flags & MS_RDONLY)) |
773 | mode |= FMODE_WRITE; | 773 | mode |= FMODE_WRITE; |
774 | 774 | ||
775 | bdev = open_bdev_exclusive(dev_name, mode, fs_type); | 775 | bdev = blkdev_get_by_path(dev_name, mode, fs_type); |
776 | if (IS_ERR(bdev)) | 776 | if (IS_ERR(bdev)) |
777 | return ERR_CAST(bdev); | 777 | return ERR_CAST(bdev); |
778 | 778 | ||
@@ -807,7 +807,7 @@ struct dentry *mount_bdev(struct file_system_type *fs_type, | |||
807 | * holding an active reference. | 807 | * holding an active reference. |
808 | */ | 808 | */ |
809 | up_write(&s->s_umount); | 809 | up_write(&s->s_umount); |
810 | blkdev_put(bdev, mode | FMODE_EXCL); | 810 | blkdev_put(bdev, mode); |
811 | down_write(&s->s_umount); | 811 | down_write(&s->s_umount); |
812 | } else { | 812 | } else { |
813 | char b[BDEVNAME_SIZE]; | 813 | char b[BDEVNAME_SIZE]; |
@@ -831,7 +831,7 @@ struct dentry *mount_bdev(struct file_system_type *fs_type, | |||
831 | error_s: | 831 | error_s: |
832 | error = PTR_ERR(s); | 832 | error = PTR_ERR(s); |
833 | error_bdev: | 833 | error_bdev: |
834 | blkdev_put(bdev, mode | FMODE_EXCL); | 834 | blkdev_put(bdev, mode); |
835 | error: | 835 | error: |
836 | return ERR_PTR(error); | 836 | return ERR_PTR(error); |
837 | } | 837 | } |
@@ -862,6 +862,7 @@ void kill_block_super(struct super_block *sb) | |||
862 | bdev->bd_super = NULL; | 862 | bdev->bd_super = NULL; |
863 | generic_shutdown_super(sb); | 863 | generic_shutdown_super(sb); |
864 | sync_blockdev(bdev); | 864 | sync_blockdev(bdev); |
865 | WARN_ON_ONCE(!(mode & FMODE_EXCL)); | ||
865 | blkdev_put(bdev, mode | FMODE_EXCL); | 866 | blkdev_put(bdev, mode | FMODE_EXCL); |
866 | } | 867 | } |
867 | 868 | ||