qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Fam Zheng <famz@redhat.com>
Cc: qemu-devel@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH for-2.10 3/4] block-backend: Defer shared_perm tightening migration completion
Date: Tue, 15 Aug 2017 12:50:05 +0100	[thread overview]
Message-ID: <20170815115005.GA21670@stefanha-x1.localdomain> (raw)
In-Reply-To: <20170815040454.4223-4-famz@redhat.com>

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

On Tue, Aug 15, 2017 at 12:04:53PM +0800, Fam Zheng wrote:
> @@ -147,6 +166,24 @@ static void blk_root_activate(BdrvChild *child, Error **errp)
>  
>      blk->disable_perm = false;
>  
> +    blk_set_perm(blk, blk->perm, BLK_PERM_ALL, &local_err);
> +    if (local_err) {
> +        error_propagate(errp, local_err);
> +        blk->disable_perm = true;
> +        return;
> +    }
> +
> +    if (runstate_check(RUN_STATE_INMIGRATE)) {
> +        /* Activation can happen when migration process is still active, for
> +         * example when nbd_server_add is called during non-shared storage
> +         * migration. Defer the shared_perm update to migration completion. */
> +        if (!blk->vmsh) {
> +            blk->vmsh = qemu_add_vm_change_state_handler(blk_vm_state_changed,
> +                                                         blk);

Please add a qemu_del_vm_change_state_handler() call to cover the case
where the BB is deleted before the migration state changes.

This is necessary to prevent a memory leak and a crash when the change
state handler is invoked.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

  reply	other threads:[~2017-08-15 11:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-15  4:04 [Qemu-devel] [PATCH for-2.10 0/4] block: Fix non-shared storage migration Fam Zheng
2017-08-15  4:04 ` [Qemu-devel] [PATCH for-2.10 1/4] stubs: Add vm state change handler stubs Fam Zheng
2017-08-15 12:26   ` Eric Blake
2017-08-15 12:44     ` Fam Zheng
2017-08-15  4:04 ` [Qemu-devel] [PATCH for-2.10 2/4] nbd: Fix order of bdrv_set_perm and bdrv_invalidate_cache Fam Zheng
2017-08-15  4:04 ` [Qemu-devel] [PATCH for-2.10 3/4] block-backend: Defer shared_perm tightening migration completion Fam Zheng
2017-08-15 11:50   ` Stefan Hajnoczi [this message]
2017-08-15  4:04 ` [Qemu-devel] [PATCH for-2.10 4/4] iotests: Add non-shared storage migration case 192 Fam Zheng

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=20170815115005.GA21670@stefanha-x1.localdomain \
    --to=stefanha@gmail.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@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).