Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f794e3c authored by Anand Jain's avatar Anand Jain Committed by David Sterba
Browse files

btrfs: fail mount when sb flag is not in BTRFS_SUPER_FLAG_SUPP



It appears from the original commit [1] that there isn't any design
specific reason not to fail the mount instead of just warning. This
patch will change it to fail.

[1]
 commit 319e4d06
    btrfs: Enhance super validation check

Fixes: 319e4d06 ("btrfs: Enhance super validation check")
Signed-off-by: default avatarAnand Jain <anand.jain@oracle.com>
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 98820a7e
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -3907,9 +3907,11 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info)
		btrfs_err(fs_info, "no valid FS found");
		btrfs_err(fs_info, "no valid FS found");
		ret = -EINVAL;
		ret = -EINVAL;
	}
	}
	if (btrfs_super_flags(sb) & ~BTRFS_SUPER_FLAG_SUPP)
	if (btrfs_super_flags(sb) & ~BTRFS_SUPER_FLAG_SUPP) {
		btrfs_warn(fs_info, "unrecognized super flag: %llu",
		btrfs_err(fs_info, "unrecognized or unsupported super flag: %llu",
				btrfs_super_flags(sb) & ~BTRFS_SUPER_FLAG_SUPP);
				btrfs_super_flags(sb) & ~BTRFS_SUPER_FLAG_SUPP);
		ret = -EINVAL;
	}
	if (btrfs_super_root_level(sb) >= BTRFS_MAX_LEVEL) {
	if (btrfs_super_root_level(sb) >= BTRFS_MAX_LEVEL) {
		btrfs_err(fs_info, "tree_root level too big: %d >= %d",
		btrfs_err(fs_info, "tree_root level too big: %d >= %d",
				btrfs_super_root_level(sb), BTRFS_MAX_LEVEL);
				btrfs_super_root_level(sb), BTRFS_MAX_LEVEL);