aboutsummaryrefslogtreecommitdiffstats
path: root/fs/super.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-01-13 13:45:01 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-13 13:45:01 -0500
commit275220f0fcff1adf28a717076e00f575edf05fda (patch)
treed249bccc80c64443dab211639050c4fb14332648 /fs/super.c
parentfe3c560b8a22cb28e54fe8950abef38e88d75831 (diff)
parent81c5e2ae33c4b19e53966b427e33646bf6811830 (diff)
Merge branch 'for-2.6.38/core' of git://git.kernel.dk/linux-2.6-block
* 'for-2.6.38/core' of git://git.kernel.dk/linux-2.6-block: (43 commits) block: ensure that completion error gets properly traced blktrace: add missing probe argument to block_bio_complete block cfq: don't use atomic_t for cfq_group block cfq: don't use atomic_t for cfq_queue block: trace event block fix unassigned field block: add internal hd part table references block: fix accounting bug on cross partition merges kref: add kref_test_and_get bio-integrity: mark kintegrityd_wq highpri and CPU intensive block: make kblockd_workqueue smarter Revert "sd: implement sd_check_events()" block: Clean up exit_io_context() source code. Fix compile warnings due to missing removal of a 'ret' variable fs/block: type signature of major_to_index(int) to major_to_index(unsigned) block: convert !IS_ERR(p) && p to !IS_ERR_NOR_NULL(p) cfq-iosched: don't check cfqg in choose_service_tree() fs/splice: Pull buf->ops->confirm() from splice_from_pipe actors cdrom: export cdrom_check_events() sd: implement sd_check_events() sr: implement sr_check_events() ...
Diffstat (limited to 'fs/super.c')
-rw-r--r--fs/super.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/fs/super.c b/fs/super.c
index 823e061faa87..4f6a3571a634 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,
832error_s: 832error_s:
833 error = PTR_ERR(s); 833 error = PTR_ERR(s);
834error_bdev: 834error_bdev:
835 close_bdev_exclusive(bdev, mode); 835 blkdev_put(bdev, mode);
836error: 836error:
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
869EXPORT_SYMBOL(kill_block_super); 870EXPORT_SYMBOL(kill_block_super);