Commit 3d7babdc authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba
Browse files

btrfs: hold a ref on the root in find_data_references



We're looking up the data references for the bytenr in a root, we need
to hold a ref on that root while we're doing that.

Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 442b1ac5
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -3751,7 +3751,11 @@ static int find_data_references(struct reloc_control *rc,
	root = read_fs_root(fs_info, ref_root);
	if (IS_ERR(root)) {
		err = PTR_ERR(root);
		goto out;
		goto out_free;
	}
	if (!btrfs_grab_fs_root(root)) {
		err = -ENOENT;
		goto out_free;
	}

	key.objectid = ref_objectid;
@@ -3864,6 +3868,8 @@ static int find_data_references(struct reloc_control *rc,

	}
out:
	btrfs_put_fs_root(root);
out_free:
	btrfs_free_path(path);
	return err;
}