We look up an arbitrary fs root, we need to hold a ref on it while we're
doing our search.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
root = btrfs_get_fs_root(info, &key, true);
if (IS_ERR(root)) {
ret = PTR_ERR(root);
root = btrfs_get_fs_root(info, &key, true);
if (IS_ERR(root)) {
ret = PTR_ERR(root);
+ root = NULL;
+ goto out;
+ }
+ if (!btrfs_grab_fs_root(root)) {
+ ret = -ENOENT;
+ root = NULL;
name[total_len] = '\0';
ret = 0;
out:
name[total_len] = '\0';
ret = 0;
out:
+ btrfs_put_fs_root(root);
btrfs_free_path(path);
return ret;
}
btrfs_free_path(path);
return ret;
}