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 <quwen...@cn.fujitsu.com>
Tested-by: Austin S. Hemmelgarn <ahferro...@gmail.com>
Tested-by: Adam Borowski <kilob...@angband.pl>
Tested-by: Dmitrii Tcvetkov <demfl...@demfloro.ru>
---
 fs/btrfs/super.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index da687dc79cce..1f5772501c92 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1784,9 +1784,8 @@ 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 &&
-                   !(*flags & MS_RDONLY)) {
+               if (!(*flags & MS_RDONLY) &&
+                   !btrfs_check_rw_degradable(fs_info)) {
                        btrfs_warn(fs_info,
                                "too many missing devices, writeable remount is 
not allowed");
                        ret = -EACCES;
-- 
2.12.0



--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to