Merge tag 'for-6.2-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave...
[sfrench/cifs-2.6.git] / fs / btrfs / disk-io.c
index 0888d484df80c93245e9d77cccabd3e093e0fc00..8aeaada1fcaec2a9de8128cac61d29fafef5210c 100644 (file)
@@ -530,6 +530,9 @@ static int validate_extent_buffer(struct extent_buffer *eb,
        }
 
        if (found_level != check->level) {
+               btrfs_err(fs_info,
+               "level verify failed on logical %llu mirror %u wanted %u found %u",
+                         eb->start, eb->read_mirror, check->level, found_level);
                ret = -EIO;
                goto out;
        }
@@ -3381,6 +3384,8 @@ out:
 /*
  * Do various sanity and dependency checks of different features.
  *
+ * @is_rw_mount:       If the mount is read-write.
+ *
  * This is the place for less strict checks (like for subpage or artificial
  * feature dependencies).
  *
@@ -3391,7 +3396,7 @@ out:
  * (space cache related) can modify on-disk format like free space tree and
  * screw up certain feature dependencies.
  */
-int btrfs_check_features(struct btrfs_fs_info *fs_info, struct super_block *sb)
+int btrfs_check_features(struct btrfs_fs_info *fs_info, bool is_rw_mount)
 {
        struct btrfs_super_block *disk_super = fs_info->super_copy;
        u64 incompat = btrfs_super_incompat_flags(disk_super);
@@ -3430,7 +3435,7 @@ int btrfs_check_features(struct btrfs_fs_info *fs_info, struct super_block *sb)
        if (btrfs_super_nodesize(disk_super) > PAGE_SIZE)
                incompat |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA;
 
-       if (compat_ro_unsupp && !sb_rdonly(sb)) {
+       if (compat_ro_unsupp && is_rw_mount) {
                btrfs_err(fs_info,
        "cannot mount read-write because of unknown compat_ro features (0x%llx)",
                       compat_ro);
@@ -3633,7 +3638,7 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
                goto fail_alloc;
        }
 
-       ret = btrfs_check_features(fs_info, sb);
+       ret = btrfs_check_features(fs_info, !sb_rdonly(sb));
        if (ret < 0) {
                err = ret;
                goto fail_alloc;