summaryrefslogtreecommitdiffstats
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)
downloadop-kernel-dev-30c40d2c01f68c7eb1a41ab3552bdaf5dbf300d4.zip
op-kernel-dev-30c40d2c01f68c7eb1a41ab3552bdaf5dbf300d4.tar.gz
[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 e931ae9..0d77ac2 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -760,9 +760,13 @@ int get_sb_bdev(struct file_system_type *fs_type,
{
struct block_device *bdev;
struct super_block *s;
+ fmode_t mode = FMODE_READ;
int error = 0;
- bdev = open_bdev_excl(dev_name, flags, fs_type);
+ if (!(flags & MS_RDONLY))
+ mode |= FMODE_WRITE;
+
+ bdev = open_bdev_exclusive(dev_name, mode, fs_type);
if (IS_ERR(bdev))
return PTR_ERR(bdev);
@@ -785,11 +789,12 @@ int get_sb_bdev(struct file_system_type *fs_type,
goto error_bdev;
}
- close_bdev_excl(bdev);
+ close_bdev_exclusive(bdev, mode);
} else {
char b[BDEVNAME_SIZE];
s->s_flags = flags;
+ s->s_mode = mode;
strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id));
sb_set_blocksize(s, block_size(bdev));
error = fill_super(s, data, flags & MS_SILENT ? 1 : 0);
@@ -807,7 +812,7 @@ int get_sb_bdev(struct file_system_type *fs_type,
error_s:
error = PTR_ERR(s);
error_bdev:
- close_bdev_excl(bdev);
+ close_bdev_exclusive(bdev, mode);
error:
return error;
}
@@ -817,10 +822,11 @@ EXPORT_SYMBOL(get_sb_bdev);
void kill_block_super(struct super_block *sb)
{
struct block_device *bdev = sb->s_bdev;
+ fmode_t mode = sb->s_mode;
generic_shutdown_super(sb);
sync_blockdev(bdev);
- close_bdev_excl(bdev);
+ close_bdev_exclusive(bdev, mode);
}
EXPORT_SYMBOL(kill_block_super);
OpenPOWER on IntegriCloud