summaryrefslogtreecommitdiffstats
path: root/fs/nilfs2
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-05-09 02:57:57 +0900
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-05-10 11:32:33 +0900
commit13e905592b3daacb6ec27a5a4169afe725c3b668 (patch)
tree1eb7a70bf662d1efcea73e4e06239dee333dbdf8 /fs/nilfs2
parent400ade845cb9930552e791bbd658a0953f68499d (diff)
downloadlinux-13e905592b3daacb6ec27a5a4169afe725c3b668.tar.gz
linux-13e905592b3daacb6ec27a5a4169afe725c3b668.tar.bz2
linux-13e905592b3daacb6ec27a5a4169afe725c3b668.zip
nilfs2: fix misuse of open_bdev_exclusive/close_bdev_exclusive
The second argument of open_bdev_exclusive/close_bdev_exclusive takes fmode_t flags instead of mount flags. This fixes the misuse. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2')
-rw-r--r--fs/nilfs2/super.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index 430a508b212f..3ff2118abd7d 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -998,10 +998,14 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags,
{
struct nilfs_super_data sd;
struct super_block *s;
+ fmode_t mode = FMODE_READ;
struct the_nilfs *nilfs;
int err, need_to_close = 1;
- sd.bdev = open_bdev_exclusive(dev_name, flags, fs_type);
+ if (!(flags & MS_RDONLY))
+ mode |= FMODE_WRITE;
+
+ sd.bdev = open_bdev_exclusive(dev_name, mode, fs_type);
if (IS_ERR(sd.bdev))
return PTR_ERR(sd.bdev);
@@ -1082,7 +1086,7 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags,
mutex_unlock(&nilfs->ns_mount_mutex);
put_nilfs(nilfs);
if (need_to_close)
- close_bdev_exclusive(sd.bdev, flags);
+ close_bdev_exclusive(sd.bdev, mode);
simple_set_mnt(mnt, s);
return 0;
@@ -1090,7 +1094,7 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags,
mutex_unlock(&nilfs->ns_mount_mutex);
put_nilfs(nilfs);
failed:
- close_bdev_exclusive(sd.bdev, flags);
+ close_bdev_exclusive(sd.bdev, mode);
return err;