diff options
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r-- | fs/btrfs/super.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 9dbf42395153..5011aadacab8 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -66,6 +66,8 @@ | |||
66 | static const struct super_operations btrfs_super_ops; | 66 | static const struct super_operations btrfs_super_ops; |
67 | static struct file_system_type btrfs_fs_type; | 67 | static struct file_system_type btrfs_fs_type; |
68 | 68 | ||
69 | static int btrfs_remount(struct super_block *sb, int *flags, char *data); | ||
70 | |||
69 | static const char *btrfs_decode_error(int errno) | 71 | static const char *btrfs_decode_error(int errno) |
70 | { | 72 | { |
71 | char *errstr = "unknown"; | 73 | char *errstr = "unknown"; |
@@ -1185,6 +1187,26 @@ static struct dentry *mount_subvol(const char *subvol_name, int flags, | |||
1185 | mnt = vfs_kern_mount(&btrfs_fs_type, flags, device_name, | 1187 | mnt = vfs_kern_mount(&btrfs_fs_type, flags, device_name, |
1186 | newargs); | 1188 | newargs); |
1187 | kfree(newargs); | 1189 | kfree(newargs); |
1190 | |||
1191 | if (PTR_RET(mnt) == -EBUSY) { | ||
1192 | if (flags & MS_RDONLY) { | ||
1193 | mnt = vfs_kern_mount(&btrfs_fs_type, flags & ~MS_RDONLY, device_name, | ||
1194 | newargs); | ||
1195 | } else { | ||
1196 | int r; | ||
1197 | mnt = vfs_kern_mount(&btrfs_fs_type, flags | MS_RDONLY, device_name, | ||
1198 | newargs); | ||
1199 | if (IS_ERR(mnt)) | ||
1200 | return ERR_CAST(mnt); | ||
1201 | |||
1202 | r = btrfs_remount(mnt->mnt_sb, &flags, NULL); | ||
1203 | if (r < 0) { | ||
1204 | /* FIXME: release vfsmount mnt ??*/ | ||
1205 | return ERR_PTR(r); | ||
1206 | } | ||
1207 | } | ||
1208 | } | ||
1209 | |||
1188 | if (IS_ERR(mnt)) | 1210 | if (IS_ERR(mnt)) |
1189 | return ERR_CAST(mnt); | 1211 | return ERR_CAST(mnt); |
1190 | 1212 | ||