diff options
-rw-r--r-- | fs/btrfs/disk-io.c | 7 | ||||
-rw-r--r-- | fs/btrfs/super.c | 9 |
2 files changed, 16 insertions, 0 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index bd70c2852ba0..064315990f8a 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -2508,6 +2508,13 @@ retry_root_backup: | |||
2508 | } | 2508 | } |
2509 | fs_info->num_tolerated_disk_barrier_failures = | 2509 | fs_info->num_tolerated_disk_barrier_failures = |
2510 | btrfs_calc_num_tolerated_disk_barrier_failures(fs_info); | 2510 | btrfs_calc_num_tolerated_disk_barrier_failures(fs_info); |
2511 | if (fs_info->fs_devices->missing_devices > | ||
2512 | fs_info->num_tolerated_disk_barrier_failures && | ||
2513 | !(sb->s_flags & MS_RDONLY)) { | ||
2514 | printk(KERN_WARNING | ||
2515 | "Btrfs: too many missing devices, writeable mount is not allowed\n"); | ||
2516 | goto fail_block_groups; | ||
2517 | } | ||
2511 | 2518 | ||
2512 | fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root, | 2519 | fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root, |
2513 | "btrfs-cleaner"); | 2520 | "btrfs-cleaner"); |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 915ac14c2064..acd2df85bed5 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -1226,6 +1226,15 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) | |||
1226 | goto restore; | 1226 | goto restore; |
1227 | } | 1227 | } |
1228 | 1228 | ||
1229 | if (fs_info->fs_devices->missing_devices > | ||
1230 | fs_info->num_tolerated_disk_barrier_failures && | ||
1231 | !(*flags & MS_RDONLY)) { | ||
1232 | printk(KERN_WARNING | ||
1233 | "Btrfs: too many missing devices, writeable remount is not allowed\n"); | ||
1234 | ret = -EACCES; | ||
1235 | goto restore; | ||
1236 | } | ||
1237 | |||
1229 | if (btrfs_super_log_root(fs_info->super_copy) != 0) { | 1238 | if (btrfs_super_log_root(fs_info->super_copy) != 0) { |
1230 | ret = -EINVAL; | 1239 | ret = -EINVAL; |
1231 | goto restore; | 1240 | goto restore; |