From: Eric Blake <eblake@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Fam Zheng <famz@redhat.com>,
qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH for-2.11] block: Keep strong reference when draining all BDS
Date: Thu, 9 Nov 2017 15:02:23 -0600 [thread overview]
Message-ID: <e9e49f18-cf12-1dc0-4bd0-ae67c36fb30c@redhat.com> (raw)
In-Reply-To: <20171109204315.27072-1-mreitz@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1668 bytes --]
On 11/09/2017 02:43 PM, Max Reitz wrote:
> Draining a BDS may lead to graph modifications, which in turn may result
> in it and other BDS being stripped of their current references. If
> bdrv_drain_all_begin() and bdrv_drain_all_end() do not keep strong
> references themselves, the BDS they are trying to drain (or undrain) may
> disappear right under their feet -- or, more specifically, under the
> feet of BDRV_POLL_WHILE() in bdrv_drain_recurse().
>
> This fixes an occasional hang of iotest 194.
>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> block/io.c | 47 ++++++++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 44 insertions(+), 3 deletions(-)
> +
> + /* Keep a strong reference to all root BDS and copy them into
> + * an own list because draining them may lead to graph
'an own' sounds awkward; maybe 'copy them into a local list'
> + * modifications. */
> + bdrv_ref(bs);
> + bs_list = g_slist_prepend(bs_list, bs);
> }
> void bdrv_drain_all_end(void)
> {
> BlockDriverState *bs;
> BdrvNextIterator it;
> + GSList *bs_list = NULL, *bs_list_entry;
> +
> + /* Must be called from the main loop */
> + assert(qemu_get_current_aio_context() == qemu_get_aio_context());
>
> + /* Keep a strong reference to all root BDS and copy them into an
> + * own list because draining them may lead to graph modifications.
And again.
With that tweak,
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]
next prev parent reply other threads:[~2017-11-09 21:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-09 20:43 [Qemu-devel] [PATCH for-2.11] block: Keep strong reference when draining all BDS Max Reitz
2017-11-09 21:02 ` Eric Blake [this message]
2017-11-10 2:45 ` Fam Zheng
2017-11-10 13:17 ` Kevin Wolf
2017-11-10 13:32 ` Fam Zheng
2017-11-10 15:23 ` Max Reitz
2017-11-10 15:31 ` Fam Zheng
2017-11-10 16:05 ` Kevin Wolf
2017-11-10 16:13 ` Max Reitz
2017-11-10 16:22 ` Kevin Wolf
2017-11-10 16:43 ` Max Reitz
2017-11-10 9:19 ` Stefan Hajnoczi
2017-11-10 15:26 ` Max Reitz
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=e9e49f18-cf12-1dc0-4bd0-ae67c36fb30c@redhat.com \
--to=eblake@redhat.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).