From: Max Reitz <mreitz@redhat.com>
To: John Snow <jsnow@redhat.com>,
qemu-block@nongnu.org, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, Markus Armbruster <armbru@redhat.com>,
jtc@redhat.com, Jeff Cody <jcody@redhat.com>,
Eric Blake <eblake@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 04/13] block/commit: refactor commit to use job callbacks
Date: Mon, 27 Aug 2018 14:07:21 +0200 [thread overview]
Message-ID: <9b363ad7-4a3f-e0d7-fa0c-a3fa006f7f00@redhat.com> (raw)
In-Reply-To: <20180823222249.13518-5-jsnow@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2532 bytes --]
On 2018-08-24 00:22, John Snow wrote:
> Use the component callbacks; prepare, abort, and clean.
>
> NB: prepare is only called when the job has not yet failed;
> and abort can be called after prepare.
>
> complete -> prepare -> abort -> clean
> complete -> abort -> clean
>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
> block/commit.c | 90 ++++++++++++++++++++++++++++++++--------------------------
> 1 file changed, 49 insertions(+), 41 deletions(-)
>
> diff --git a/block/commit.c b/block/commit.c
> index b6e8969877..9bf50385cf 100644
> --- a/block/commit.c
> +++ b/block/commit.c
[...]
> @@ -68,61 +69,65 @@ static int coroutine_fn commit_populate(BlockBackend *bs, BlockBackend *base,
[...]
> +static void commit_abort(Job *job)
> +{
> + CommitBlockJob *s = container_of(job, CommitBlockJob, common.job);
> + BlockDriverState *top_bs = blk_bs(s->top);
> +
> + /* Make sure commit_top_bs and top stay around until bdrv_replace_node() */
> + bdrv_ref(top_bs);
> + bdrv_ref(s->commit_top_bs);
> +
> + if (s->base) {
> + blk_unref(s->base);
> }
>
> + /* free the blockers on the intermediate nodes so that bdrv_replace_nodes
> + * can succeed */
> + block_job_remove_all_bdrv(&s->common);
> +
> + /* If bdrv_drop_intermediate() didn't already do that, remove the commit
> + * filter driver from the backing chain. Do this as the final step so that
> + * the 'consistent read' permission can be granted.
I'd suggest rewording this to "If bdrv_drop_intermediate() failed (or
was not invoked at all), remove the commit filter driver from the
backing chain now."
Right now it sounds like maybe bdrv_drop_intermediate() removes the
filter, and maybe it doesn't. But actually it is supposed to always
remove it -- but it may fail, and then we have to force-remove the filter.
Apart from that:
Reviewed-by: Max Reitz <mreitz@redhat.com>
> + *
> + * XXX Can (or should) we somehow keep 'consistent read' blocked even
> + * after the failed/cancelled commit job is gone? If we already wrote
> + * something to base, the intermediate images aren't valid any more. */
> + bdrv_child_try_set_perm(s->commit_top_bs->backing, 0, BLK_PERM_ALL,
> + &error_abort);
> + bdrv_replace_node(s->commit_top_bs, backing_bs(s->commit_top_bs),
> + &error_abort);
> +
> + bdrv_unref(s->commit_top_bs);
> + bdrv_unref(top_bs);
> +}
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2018-08-27 12:16 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-23 22:22 [Qemu-devel] [PATCH v2 00/13] jobs: jobs: Job Exit Refactoring Pt 2 John Snow
2018-08-23 22:22 ` [Qemu-devel] [PATCH v2 01/13] block/commit: add block job creation flags John Snow
2018-08-27 11:21 ` Max Reitz
2018-08-23 22:22 ` [Qemu-devel] [PATCH v2 02/13] block/mirror: " John Snow
2018-08-27 11:25 ` Max Reitz
2018-08-23 22:22 ` [Qemu-devel] [PATCH v2 03/13] block/stream: " John Snow
2018-08-27 11:26 ` Max Reitz
2018-08-23 22:22 ` [Qemu-devel] [PATCH v2 04/13] block/commit: refactor commit to use job callbacks John Snow
2018-08-27 12:07 ` Max Reitz [this message]
2018-08-23 22:22 ` [Qemu-devel] [PATCH v2 05/13] block/mirror: conservative mirror_exit refactor John Snow
2018-08-27 12:47 ` Max Reitz
2018-08-31 22:21 ` John Snow
2018-08-23 22:22 ` [Qemu-devel] [PATCH v2 06/13] block/commit: refactor stream to use job callbacks John Snow
2018-08-27 12:52 ` Max Reitz
2018-08-23 22:22 ` [Qemu-devel] [PATCH v2 07/13] tests/blockjob: replace Blockjob with Job John Snow
2018-08-27 13:36 ` Max Reitz
2018-08-23 22:22 ` [Qemu-devel] [PATCH v2 08/13] tests/test-blockjob: remove exit callback John Snow
2018-08-27 13:41 ` Max Reitz
2018-08-23 22:22 ` [Qemu-devel] [PATCH v2 09/13] jobs: remove .exit callback John Snow
2018-08-27 13:47 ` Max Reitz
2018-08-23 22:22 ` [Qemu-devel] [PATCH v2 10/13] qapi/block-commit: expose new job properties John Snow
2018-08-27 13:57 ` Max Reitz
2018-08-23 22:22 ` [Qemu-devel] [PATCH v2 11/13] qapi/block-mirror: " John Snow
2018-08-27 13:59 ` Max Reitz
2018-08-23 22:22 ` [Qemu-devel] [PATCH v2 12/13] qapi/block-stream: " John Snow
2018-08-27 14:03 ` Max Reitz
2018-08-23 22:22 ` [Qemu-devel] [PATCH v2 13/13] block/backup: qapi documentation fixup John Snow
2018-08-27 14:03 ` 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=9b363ad7-4a3f-e0d7-fa0c-a3fa006f7f00@redhat.com \
--to=mreitz@redhat.com \
--cc=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=eblake@redhat.com \
--cc=jcody@redhat.com \
--cc=jsnow@redhat.com \
--cc=jtc@redhat.com \
--cc=kwolf@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).