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: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
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;
}
out:
+ btrfs_put_fs_root(root);
+out_free:
btrfs_free_path(path);
return err;
}