qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>,
	qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3 1/2] block: Fix flags in reopen queue
Date: Tue, 13 Mar 2018 16:22:51 +0100	[thread overview]
Message-ID: <20180313152251.GF4642@localhost.localdomain> (raw)
In-Reply-To: <20180313142003.12124-2-famz@redhat.com>

Am 13.03.2018 um 15:20 hat Fam Zheng geschrieben:
> Reopen flags are not synchronized according to the
> bdrv_reopen_queue_child precedence until bdrv_reopen_prepare. It is a
> bit too late: we already check the consistency in bdrv_check_perm before
> that.
> 
> This fixes the bug that when bdrv_reopen a RO node as RW, the flags for
> backing child are wrong. Before, we could recurse with flags.rw=1; now,
> role->inherit_options + update_flags_from_options will make sure to
> clear the bit when necessary.  Note that this will not clear an
> explicitly set bit, as in the case of parallel block jobs (e.g.
> test_stream_parallel in 030), because the explicit options include
> 'read-only=false' (for an intermediate node used by a different job).
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  block.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/block.c b/block.c
> index 75a9fd49de..a121d2ebcc 100644
> --- a/block.c
> +++ b/block.c
> @@ -2883,8 +2883,15 @@ static BlockReopenQueue *bdrv_reopen_queue_child(BlockReopenQueue *bs_queue,
>  
>      /* Inherit from parent node */
>      if (parent_options) {
> +        QemuOpts *opts;
> +        QDict *options_copy;
>          assert(!flags);
>          role->inherit_options(&flags, options, parent_flags, parent_options);
> +        options_copy = qdict_clone_shallow(options);
> +        opts = qemu_opts_create(&bdrv_runtime_opts, NULL, 0, &error_abort);
> +        qemu_opts_absorb_qdict(opts, options_copy, NULL);
> +        update_flags_from_options(&flags, opts);
> +        qemu_opts_del(opts);

Squashed in a line here after Fam and Max agreed on IRC:

+        QDECREF(options_copy);

>      }
>  
>      /* Old values are used for options that aren't set yet */

Kevin

  reply	other threads:[~2018-03-13 15:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-13 14:20 [Qemu-devel] [PATCH v3 0/2] block: Fix permission during reopen Fam Zheng
2018-03-13 14:20 ` [Qemu-devel] [PATCH v3 1/2] block: Fix flags in reopen queue Fam Zheng
2018-03-13 15:22   ` Kevin Wolf [this message]
2018-03-13 14:20 ` [Qemu-devel] [PATCH v3 2/2] iotests: Add regression test for commit base locking Fam Zheng
2018-03-13 14:22 ` [Qemu-devel] [PATCH v3 0/2] block: Fix permission during reopen Max Reitz
2018-03-13 14:50 ` 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=20180313152251.GF4642@localhost.localdomain \
    --to=kwolf@redhat.com \
    --cc=famz@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).