qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Cc: jcody@redhat.com, famz@redhat.com, qemu-devel@nongnu.org,
	mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH 09/10] block: Handle permission errors in change_parent_backing_link()
Date: Mon, 6 Mar 2017 15:19:58 -0600	[thread overview]
Message-ID: <15283523-94bb-7310-6a27-5d50468c7320@redhat.com> (raw)
In-Reply-To: <1488817322-11397-10-git-send-email-kwolf@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1656 bytes --]

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 <kwolf@redhat.com>
> ---
>  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 <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2017-03-06 21:20 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-06 16:21 [Qemu-devel] [PATCH 00/10] block: Op blocker fixes Kevin Wolf
2017-03-06 16:21 ` [Qemu-devel] [PATCH 01/10] commit: Fix error handling Kevin Wolf
2017-03-06 16:44   ` Philippe Mathieu-Daudé
2017-03-06 16:21 ` [Qemu-devel] [PATCH 02/10] mirror: Fix permission problem with 'replaces' Kevin Wolf
2017-03-06 20:01   ` Eric Blake
2017-03-06 16:21 ` [Qemu-devel] [PATCH 03/10] mirror: Fix permissions for removing mirror_top_bs Kevin Wolf
2017-03-06 20:13   ` Eric Blake
2017-03-06 16:21 ` [Qemu-devel] [PATCH 04/10] mirror: Fix error path for dirty bitmap creation Kevin Wolf
2017-03-06 20:15   ` Eric Blake
2017-03-06 16:21 ` [Qemu-devel] [PATCH 05/10] block: Fix blockdev-snapshot error handling Kevin Wolf
2017-03-06 20:23   ` Eric Blake
2017-03-07 12:32     ` Kevin Wolf
2017-03-06 16:21 ` [Qemu-devel] [PATCH 06/10] block: Factor out should_update_child() Kevin Wolf
2017-03-06 20:35   ` Eric Blake
2017-03-07  0:00     ` Philippe Mathieu-Daudé
2017-03-06 16:21 ` [Qemu-devel] [PATCH 07/10] block: Factor out bdrv_replace_child_noperm() Kevin Wolf
2017-03-06 20:36   ` Eric Blake
2017-03-06 16:22 ` [Qemu-devel] [PATCH 08/10] block: Ignore multiple children in bdrv_check_update_perm() Kevin Wolf
2017-03-06 21:07   ` Eric Blake
2017-03-06 16:22 ` [Qemu-devel] [PATCH 09/10] block: Handle permission errors in change_parent_backing_link() Kevin Wolf
2017-03-06 21:19   ` Eric Blake [this message]
2017-03-06 16:22 ` [Qemu-devel] [PATCH 10/10] block: Fix error handling in bdrv_replace_in_backing_chain() Kevin Wolf
2017-03-06 21:22   ` Eric Blake
2017-03-07  9:06 ` [Qemu-devel] [PATCH 00/10] block: Op blocker fixes Fam Zheng
2017-03-07 12:36 ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15283523-94bb-7310-6a27-5d50468c7320@redhat.com \
    --to=eblake@redhat.com \
    --cc=famz@redhat.com \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).