aboutsummaryrefslogtreecommitdiffstats
path: root/fs/super.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-02-22 19:50:45 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2008-10-21 07:49:00 -0400
commit30c40d2c01f68c7eb1a41ab3552bdaf5dbf300d4 (patch)
tree38b69a80c4c0df13ef3b905f5195f6cadf930223 /fs/super.c
parent9a1c3542768b5a58e45a9216921cd10a3bae1205 (diff)
[PATCH] propagate mode through open_bdev_excl/close_bdev_excl
replace open_bdev_excl/close_bdev_excl with variants taking fmode_t. superblock gets the value used to mount it stored in sb->s_mode Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
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 e931ae9511fe..0d77ac20d03e 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -760,9 +760,13 @@ int get_sb_bdev(struct file_system_type *fs_type,
760{ 760{
761 struct block_device *bdev; 761 struct block_device *bdev;
762 struct super_block *s; 762 struct super_block *s;
763 fmode_t mode = FMODE_READ;
763 int error = 0; 764 int error = 0;
764 765
765 bdev = open_bdev_excl(dev_name, flags, fs_type); 766 if (!(flags & MS_RDONLY))
767 mode |= FMODE_WRITE;
768
769 bdev = open_bdev_exclusive(dev_name, mode, fs_type);
766 if (IS_ERR(bdev)) 770 if (IS_ERR(bdev))
767 return PTR_ERR(bdev); 771 return PTR_ERR(bdev);
768 772
@@ -785,11 +789,12 @@ int get_sb_bdev(struct file_system_type *fs_type,
785 goto error_bdev; 789 goto error_bdev;
786 } 790 }
787 791
788 close_bdev_excl(bdev); 792 close_bdev_exclusive(bdev, mode);
789 } else { 793 } else {
790 char b[BDEVNAME_SIZE]; 794 char b[BDEVNAME_SIZE];
791 795
792 s->s_flags = flags; 796 s->s_flags = flags;
797 s->s_mode = mode;
793 strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); 798 strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id));
794 sb_set_blocksize(s, block_size(bdev)); 799 sb_set_blocksize(s, block_size(bdev));
795 error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); 800 error = fill_super(s, data, flags & MS_SILENT ? 1 : 0);
@@ -807,7 +812,7 @@ int get_sb_bdev(struct file_system_type *fs_type,
807error_s: 812error_s:
808 error = PTR_ERR(s); 813 error = PTR_ERR(s);
809error_bdev: 814error_bdev:
810 close_bdev_excl(bdev); 815 close_bdev_exclusive(bdev, mode);
811error: 816error:
812 return error; 817 return error;
813} 818}
@@ -817,10 +822,11 @@ EXPORT_SYMBOL(get_sb_bdev);
817void kill_block_super(struct super_block *sb) 822void kill_block_super(struct super_block *sb)
818{ 823{
819 struct block_device *bdev = sb->s_bdev; 824 struct block_device *bdev = sb->s_bdev;
825 fmode_t mode = sb->s_mode;
820 826
821 generic_shutdown_super(sb); 827 generic_shutdown_super(sb);
822 sync_blockdev(bdev); 828 sync_blockdev(bdev);
823 close_bdev_excl(bdev); 829 close_bdev_exclusive(bdev, mode);
824} 830}
825 831
826EXPORT_SYMBOL(kill_block_super); 832EXPORT_SYMBOL(kill_block_super);