We look up whatever root userspace has given us, we need to hold a ref
throughout this operation.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
root = btrfs_get_fs_root(fs_info, &key, true);
if (IS_ERR(root)) {
ret = PTR_ERR(root);
+ goto out_free;
+ }
+ if (!btrfs_grab_fs_root(root)) {
+ ret = -ENOENT;
goto out;
}
root_item = &root->root_item;
ret = -EFAULT;
out:
+ btrfs_put_fs_root(root);
+out_free:
btrfs_free_path(path);
kzfree(subvol_info);
return ret;