aboutsummaryrefslogtreecommitdiffstats
path: root/fs/super.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-23 13:23:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-23 13:23:07 -0400
commit22484856402bfa1ff3defe47f6029ab0418240d9 (patch)
tree140c67bf59674da350a7b51765d6ff7eb101b597 /fs/super.c
parent5ed487bc2c44ca4e9668ef9cb54c830e2a9fac47 (diff)
parent56b26add02b4bdea81d5e0ebda60db1fe3311ad4 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/viro/bdev
* git://git.kernel.org/pub/scm/linux/kernel/git/viro/bdev: (66 commits) [PATCH] kill the rest of struct file propagation in block ioctls [PATCH] get rid of struct file use in blkdev_ioctl() BLKBSZSET [PATCH] get rid of blkdev_locked_ioctl() [PATCH] get rid of blkdev_driver_ioctl() [PATCH] sanitize blkdev_get() and friends [PATCH] remember mode of reiserfs journal [PATCH] propagate mode through swsusp_close() [PATCH] propagate mode through open_bdev_excl/close_bdev_excl [PATCH] pass fmode_t to blkdev_put() [PATCH] kill the unused bsize on the send side of /dev/loop [PATCH] trim file propagation in block/compat_ioctl.c [PATCH] end of methods switch: remove the old ones [PATCH] switch sr [PATCH] switch sd [PATCH] switch ide-scsi [PATCH] switch tape_block [PATCH] switch dcssblk [PATCH] switch dasd [PATCH] switch mtd_blkdevs [PATCH] switch mmc ...
Diffstat (limited to 'fs/super.c')
-rw-r--r--fs/super.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/super.c b/fs/super.c
index f31ef824d069..400a7608f15e 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -755,9 +755,13 @@ int get_sb_bdev(struct file_system_type *fs_type,
755{ 755{
756 struct block_device *bdev; 756 struct block_device *bdev;
757 struct super_block *s; 757 struct super_block *s;
758 fmode_t mode = FMODE_READ;
758 int error = 0; 759 int error = 0;
759 760
760 bdev = open_bdev_excl(dev_name, flags, fs_type); 761 if (!(flags & MS_RDONLY))
762 mode |= FMODE_WRITE;
763
764 bdev = open_bdev_exclusive(dev_name, mode, fs_type);
761 if (IS_ERR(bdev)) 765 if (IS_ERR(bdev))
762 return PTR_ERR(bdev); 766 return PTR_ERR(bdev);
763 767
@@ -780,11 +784,12 @@ int get_sb_bdev(struct file_system_type *fs_type,
780 goto error_bdev; 784 goto error_bdev;
781 } 785 }
782 786
783 close_bdev_excl(bdev); 787 close_bdev_exclusive(bdev, mode);
784 } else { 788 } else {
785 char b[BDEVNAME_SIZE]; 789 char b[BDEVNAME_SIZE];
786 790
787 s->s_flags = flags; 791 s->s_flags = flags;
792 s->s_mode = mode;
788 strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); 793 strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id));
789 sb_set_blocksize(s, block_size(bdev)); 794 sb_set_blocksize(s, block_size(bdev));
790 error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); 795 error = fill_super(s, data, flags & MS_SILENT ? 1 : 0);
@@ -802,7 +807,7 @@ int get_sb_bdev(struct file_system_type *fs_type,
802error_s: 807error_s:
803 error = PTR_ERR(s); 808 error = PTR_ERR(s);
804error_bdev: 809error_bdev:
805 close_bdev_excl(bdev); 810 close_bdev_exclusive(bdev, mode);
806error: 811error:
807 return error; 812 return error;
808} 813}
@@ -812,10 +817,11 @@ EXPORT_SYMBOL(get_sb_bdev);
812void kill_block_super(struct super_block *sb) 817void kill_block_super(struct super_block *sb)
813{ 818{
814 struct block_device *bdev = sb->s_bdev; 819 struct block_device *bdev = sb->s_bdev;
820 fmode_t mode = sb->s_mode;
815 821
816 generic_shutdown_super(sb); 822 generic_shutdown_super(sb);
817 sync_blockdev(bdev); 823 sync_blockdev(bdev);
818 close_bdev_excl(bdev); 824 close_bdev_exclusive(bdev, mode);
819} 825}
820 826
821EXPORT_SYMBOL(kill_block_super); 827EXPORT_SYMBOL(kill_block_super);