From: Qu Wenruo <quwen...@cn.fujitsu.com>

Just the same for mount time check, use new btrfs_check_degraded() to do
per chunk check.

Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com>

Btrfs: use btrfs_error instead of btrfs_err during remount

apply on top of the patch

[PATCH 1/1] Btrfs: consolidate btrfs_error() to btrfs_std_error()

Signed-off-by: Anand Jain <anand.j...@oracle.com>
---
 fs/btrfs/super.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 181db38..16f1412 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1664,11 +1664,14 @@ 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)) {
+               ret = btrfs_check_degradable(fs_info, *flags);
+               if (ret < 0) {
+                       btrfs_err(fs_info,
+                               "degraded writable remount failed %d", ret);
+                       goto restore;
+               } else if (ret > 0 && !btrfs_test_opt(root, DEGRADED)) {
                        btrfs_warn(fs_info,
-                               "too many missing devices, writeable remount is 
not allowed");
+                               "some device missing, but still degraded 
mountable, please remount with -o degraded option");
                        ret = -EACCES;
                        goto restore;
                }
-- 
2.4.1

--
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