btrfs: Do chunk level check for degraded remount
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Thu, 9 Mar 2017 01:34:38 +0000 (09:34 +0800)
committerDavid Sterba <dsterba@suse.com>
Wed, 16 Aug 2017 14:12:02 +0000 (16:12 +0200)
Just the same for mount time check, use btrfs_check_rw_degradable() to
check if we are OK to be remounted rw.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/super.c

index 2351794fbc44036b6be409b8fafd887e73208e2c..e4c268c250f501405254ca8e50cbae054e9e235d 100644 (file)
@@ -1781,8 +1781,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
                        goto restore;
                }
 
-               if (fs_info->fs_devices->missing_devices >
-                    fs_info->num_tolerated_disk_barrier_failures) {
+               if (!btrfs_check_rw_degradable(fs_info)) {
                        btrfs_warn(fs_info,
                                "too many missing devices, writeable remount is not allowed");
                        ret = -EACCES;