btrfs-progs: do not try to load the free space tree if it's not enabled

We were previously getting away with this because the
load_global_roots() treated ENOENT like everything was a-ok.  However
that was a bug and fixing that bug uncovered a problem where we were
unconditionally trying to load the free space tree.  Fix that by
skipping the load if we do not have the compat bit set.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Josef Bacik 2022-02-22 17:22:41 -05:00 committed by David Sterba
parent 3aacdc4404
commit 29beeb1a30

View File

@ -1149,6 +1149,8 @@ static int load_global_roots(struct btrfs_fs_info *fs_info, unsigned flags)
"csum");
if (ret)
goto out;
if (!btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE))
goto out;
ret = load_global_roots_objectid(fs_info, path,
BTRFS_FREE_SPACE_TREE_OBJECTID, flags,
"free space");