On Mon, 02/13 18:22, Kevin Wolf wrote:
> Mow that blk_insert_bs() requests the BlockBackend permissions for the

Now? :)

> node it attaches to, it can fail. Instead of aborting, pass the errors
> to the callers.
> 

[snip]

> @@ -332,11 +348,17 @@ int bdrv_commit(BlockDriverState *bs)
>  
>      /* FIXME Use real permissions */
>      src = blk_new(0, BLK_PERM_ALL);
> -    blk_insert_bs(src, bs);
> -
> -    /* FIXME Use real permissions */
>      backing = blk_new(0, BLK_PERM_ALL);
> -    blk_insert_bs(backing, bs->backing->bs);
> +
> +    ret = blk_insert_bs(src, bs, NULL);
> +    if (ret < 0) {
> +        goto ro_cleanup;
> +    }
> +
> +    ret = blk_insert_bs(backing, bs->backing->bs, NULL);

Some code in this function uses local_err + error_report_err while this and some
others use NULL as errp. It's better to consistently use local_err, something
for another day.

> +    if (ret < 0) {
> +        goto ro_cleanup;
> +    }
>  
>      length = blk_getlength(src);
>      if (length < 0) {

Reply via email to