From: Kevin Wolf <kwolf@redhat.com>
To: Alberto Garcia <berto@igalia.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
Max Reitz <mreitz@redhat.com>, Jeff Cody <jcody@redhat.com>,
Anton Nefedov <anton.nefedov@virtuozzo.com>
Subject: Re: [Qemu-devel] [PATCH for-2.11 1/1] blockjob: Make block_job_pause_all() keep a reference to the jobs
Date: Thu, 30 Nov 2017 15:43:35 +0100 [thread overview]
Message-ID: <20171130144335.GD4039@localhost.localdomain> (raw)
In-Reply-To: <w514lpbj0m8.fsf@maestria.local.igalia.com>
Am 30.11.2017 um 15:35 hat Alberto Garcia geschrieben:
> On Thu 30 Nov 2017 01:27:32 PM CET, Kevin Wolf wrote:
>
> >> Destroying a paused block job during bdrv_reopen_multiple() has two
> >> consequences:
> >>
> >> 1) The references to the nodes involved in the job are released,
> >> possibly destroying some of them. If those nodes were in the
> >> reopen queue this would trigger the problem originally described
> >> in commit 40840e419be, crashing QEMU.
> >
> > This specific problem could be avoided by making the BDS reference in
> > the reopen queue strong, i.e. bdrv_ref() in bdrv_reopen_queue_child()
> > and bdrv_unref() only at the end of bdrv_reopen_multiple().
>
> That is correct.
>
> >> 2) At the end of bdrv_reopen_multiple(), bdrv_drain_all_end() would
> >> not be doing all necessary bdrv_parent_drained_end() calls.
> >
> > If I understand correctly, you don't have a reproducer here.
>
> That's unfortunately not correct.
>
> You can use the very test case that I mentioned in the commit message:
>
> https://lists.gnu.org/archive/html/qemu-block/2017-11/msg00934.html
>
> With that one, QEMU master crashes easily because of problem (1). If I
> hold strong references in the reopen queue as you mentioned, the test
> case hangs because of problem (2).
Ok, thanks. I'll try to play with this a bit myself later.
> > It's certainly not a full solution because keeping a reference to a
> > block job does not prevent it from completing, but only from being
> > freed. Most block jobs do graph modifications, including dropping the
> > references to nodes, already when they complete, not only when they
> > are freed.
>
> Yes but the block job itself holds additional references (thanks to
> block_job_add_bdrv()).
Mirror and commit call block_job_remove_all_bdrv() during their
completion. So yes, it does help for streaming, but not for all block
jobs.
Kevin
next prev parent reply other threads:[~2017-11-30 14:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-29 17:56 [Qemu-devel] [PATCH for-2.11 0/1] blockjob: Make block_job_pause_all() keep a reference to the jobs Alberto Garcia
2017-11-29 17:56 ` [Qemu-devel] [PATCH for-2.11 1/1] " Alberto Garcia
2017-11-30 12:27 ` Kevin Wolf
2017-11-30 14:35 ` Alberto Garcia
2017-11-30 14:43 ` Kevin Wolf [this message]
2017-11-30 14:53 ` Jeff Cody
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=20171130144335.GD4039@localhost.localdomain \
--to=kwolf@redhat.com \
--cc=anton.nefedov@virtuozzo.com \
--cc=berto@igalia.com \
--cc=jcody@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).