[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH 09/10] block: Handle permission err
From: |
Eric Blake |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH 09/10] block: Handle permission errors in change_parent_backing_link() |
Date: |
Mon, 6 Mar 2017 15:19:58 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
On 03/06/2017 10:22 AM, Kevin Wolf wrote:
> Instead of just trying to change parents by parent over to reference @to
> instead of @from, and abort()ing whenever the permissions don't allow
> this, do proper permission checking beforehand and pass any error to the
> callers.
>
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
> block.c | 50 ++++++++++++++++++++++++++++++++++++++++++++------
> 1 file changed, 44 insertions(+), 6 deletions(-)
>
> + /* Now actually perform the change. We performed the permission check for
> + * all elements of @list at once, so set the permissions all at once at
> the
> + * very end. */
> + for (p = list; p != NULL; p = p->next) {
> + c = p->data;
>
> bdrv_ref(to);
> - /* FIXME Are we sure that bdrv_replace_child() can't run into
> - * &error_abort because of permissions? */
> - bdrv_replace_child(c, to, true);
> + bdrv_replace_child_noperm(c, to);
> bdrv_unref(from);
Looks awesome to get rid of a FIXME...
> @@ -2995,7 +3032,8 @@ void bdrv_replace_in_backing_chain(BlockDriverState
> *old, BlockDriverState *new)
>
> bdrv_ref(old);
>
> - change_parent_backing_link(old, new);
> + /* FIXME Proper error handling */
> + change_parent_backing_link(old, new, &error_abort);
...until this shows we are merely trimming it down to one less instance,
but are still fighting the overall battle. But we'll get there in the
end :)
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-block] [Qemu-devel] [PATCH 05/10] block: Fix blockdev-snapshot error handling, (continued)
- [Qemu-block] [PATCH 06/10] block: Factor out should_update_child(), Kevin Wolf, 2017/03/06
- [Qemu-block] [PATCH 07/10] block: Factor out bdrv_replace_child_noperm(), Kevin Wolf, 2017/03/06
- [Qemu-block] [PATCH 08/10] block: Ignore multiple children in bdrv_check_update_perm(), Kevin Wolf, 2017/03/06
- [Qemu-block] [PATCH 09/10] block: Handle permission errors in change_parent_backing_link(), Kevin Wolf, 2017/03/06
- Re: [Qemu-block] [Qemu-devel] [PATCH 09/10] block: Handle permission errors in change_parent_backing_link(),
Eric Blake <=
- [Qemu-block] [PATCH 10/10] block: Fix error handling in bdrv_replace_in_backing_chain(), Kevin Wolf, 2017/03/06
- Re: [Qemu-block] [PATCH 00/10] block: Op blocker fixes, Fam Zheng, 2017/03/07
- Re: [Qemu-block] [PATCH 00/10] block: Op blocker fixes, Kevin Wolf, 2017/03/07