Commit ada7d45b authored by Amit Dhingra's avatar Amit Dhingra Committed by David Sterba
Browse files

btrfs: ref-verify: fix IS_ERR() vs NULL check in btrfs_build_ref_tree()



btrfs_extent_root()/btrfs_global_root() does not return error pointers,
it returns NULL on error.

Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/all/aNJfvxj0anEnk9Dm@stanley.mountain/


Fixes : ed4e6b5d ("btrfs: ref-verify: handle damaged extent root tree")
CC: stable@vger.kernel.org # 6.17+
Signed-off-by: default avatarAmit Dhingra <mechanicalamit@gmail.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 0fd7e7a1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -982,7 +982,7 @@ int btrfs_build_ref_tree(struct btrfs_fs_info *fs_info)

	extent_root = btrfs_extent_root(fs_info, 0);
	/* If the extent tree is damaged we cannot ignore it (IGNOREBADROOTS). */
	if (IS_ERR(extent_root)) {
	if (!extent_root) {
		btrfs_warn(fs_info, "ref-verify: extent tree not available, disabling");
		btrfs_clear_opt(fs_info->mount_opt, REF_VERIFY);
		return 0;