aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-05-08 13:57:57 -0400
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-05-09 22:32:33 -0400
commit13e905592b3daacb6ec27a5a4169afe725c3b668 (patch)
tree1eb7a70bf662d1efcea73e4e06239dee333dbdf8
parent400ade845cb9930552e791bbd658a0953f68499d (diff)
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>
-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,
998{ 998{
999 struct nilfs_super_data sd; 999 struct nilfs_super_data sd;
1000 struct super_block *s; 1000 struct super_block *s;
1001 fmode_t mode = FMODE_READ;
1001 struct the_nilfs *nilfs; 1002 struct the_nilfs *nilfs;
1002 int err, need_to_close = 1; 1003 int err, need_to_close = 1;
1003 1004
1004 sd.bdev = open_bdev_exclusive(dev_name, flags, fs_type); 1005 if (!(flags & MS_RDONLY))
1006 mode |= FMODE_WRITE;
1007
1008 sd.bdev = open_bdev_exclusive(dev_name, mode, fs_type);
1005 if (IS_ERR(sd.bdev)) 1009 if (IS_ERR(sd.bdev))
1006 return PTR_ERR(sd.bdev); 1010 return PTR_ERR(sd.bdev);
1007 1011
@@ -1082,7 +1086,7 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags,
1082 mutex_unlock(&nilfs->ns_mount_mutex); 1086 mutex_unlock(&nilfs->ns_mount_mutex);
1083 put_nilfs(nilfs); 1087 put_nilfs(nilfs);
1084 if (need_to_close) 1088 if (need_to_close)
1085 close_bdev_exclusive(sd.bdev, flags); 1089 close_bdev_exclusive(sd.bdev, mode);
1086 simple_set_mnt(mnt, s); 1090 simple_set_mnt(mnt, s);
1087 return 0; 1091 return 0;
1088 1092
@@ -1090,7 +1094,7 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags,
1090 mutex_unlock(&nilfs->ns_mount_mutex); 1094 mutex_unlock(&nilfs->ns_mount_mutex);
1091 put_nilfs(nilfs); 1095 put_nilfs(nilfs);
1092 failed: 1096 failed:
1093 close_bdev_exclusive(sd.bdev, flags); 1097 close_bdev_exclusive(sd.bdev, mode);
1094 1098
1095 return err; 1099 return err;
1096 1100