[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [RFC PATCH 16/41] block: Add error parameter to blk_ins
From: |
Fam Zheng |
Subject: |
Re: [Qemu-block] [RFC PATCH 16/41] block: Add error parameter to blk_insert_bs() |
Date: |
Tue, 14 Feb 2017 14:58:11 +0800 |
User-agent: |
Mutt/1.7.1 (2016-10-04) |
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) {
- [Qemu-block] [RFC PATCH 12/41] block: Require .bdrv_child_perm() with child nodes, (continued)
- [Qemu-block] [RFC PATCH 12/41] block: Require .bdrv_child_perm() with child nodes, Kevin Wolf, 2017/02/13
- [Qemu-block] [RFC PATCH 13/41] block: Request real permissions in bdrv_attach_child(), Kevin Wolf, 2017/02/13
- [Qemu-block] [RFC PATCH 14/41] block: Add permissions to BlockBackend, Kevin Wolf, 2017/02/13
- [Qemu-block] [RFC PATCH 15/41] block: Add permissions to blk_new(), Kevin Wolf, 2017/02/13
- [Qemu-block] [RFC PATCH 17/41] block: Request real permissions in blk_new_open(), Kevin Wolf, 2017/02/13
- [Qemu-block] [RFC PATCH 16/41] block: Add error parameter to blk_insert_bs(), Kevin Wolf, 2017/02/13
- [Qemu-block] [RFC PATCH 18/41] block: Allow error return in BlockDevOps.change_media_cb(), Kevin Wolf, 2017/02/13
- [Qemu-block] [RFC PATCH 19/41] hw/block: Request permissions, Kevin Wolf, 2017/02/13
- [Qemu-block] [RFC PATCH 20/41] hw/block: Introduce share-rw qdev property, Kevin Wolf, 2017/02/13