@@ -2949,7 +2949,8 @@ retry_root_backup:
btrfs_calc_num_tolerated_disk_barrier_failures(fs_info);
if (fs_info->fs_devices->missing_devices >
fs_info->num_tolerated_disk_barrier_failures &&
- !(sb->s_flags & MS_RDONLY)) {
+ !(sb->s_flags & MS_RDONLY ||
+ btrfs_test_opt(fs_info->dev_root, DEGRADED))) {
pr_warn("BTRFS: missing devices(%llu) exceeds the limit(%d), writeable mount is not allowed\n",
fs_info->fs_devices->missing_devices,
fs_info->num_tolerated_disk_barrier_failures);
@@ -1666,7 +1666,8 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
if (fs_info->fs_devices->missing_devices >
fs_info->num_tolerated_disk_barrier_failures &&
- !(*flags & MS_RDONLY)) {
+ !(*flags & MS_RDONLY ||
+ btrfs_test_opt(root, DEGRADED))) {
btrfs_warn(fs_info,
"too many missing devices, writeable remount is not allowed");
ret = -EACCES;
As of now only the exception to allow mount when number of missing device is more than group profile tolerance count is RDONLY this patch adds another lateral exception DEGRADED This will enable user to recover from the following and similar volume unavailability issue raid1 volume: mkfs.btrfs -draid1 -mraid1 /dev/sdc /dev/sdd unscan the device scan: modprobe -r btrfs && modprobe btrfs <= dev scanned is cleared since kernel does not know about /dev/sdd use degraded option to mount: mount -o degraded /dev/sdc /btrfs <= sdd is not used umount /btrfs problem: following umount the mount fails even with degraded option: mount -o degraded /dev/sdc /btrfs <== fails. because: unmount triggered commit used single profile which needs all the disks Signed-off-by: Anand Jain <anand.jain@oracle.com> --- fs/btrfs/disk-io.c | 3 ++- fs/btrfs/super.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)