diff mbox series

[6/7] btrfs-progs: do not try to load the free space tree if it's not enabled

Message ID 8bbb4ad9ae314e7f3eb03d7b4d6b6e75d957a8e5.1645567860.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: various regression fixes | expand

Commit Message

Josef Bacik Feb. 22, 2022, 10:22 p.m. UTC
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>
---
 kernel-shared/disk-io.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/kernel-shared/disk-io.c b/kernel-shared/disk-io.c
index 637e8b00..f83ba884 100644
--- a/kernel-shared/disk-io.c
+++ b/kernel-shared/disk-io.c
@@ -1192,6 +1192,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");