qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: Fam Zheng <famz@redhat.com>,
	pkrempa@redhat.com, jtc@redhat.com, qemu-devel@nongnu.org,
	qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 0/4] blockjobs: add explicit job reaping
Date: Fri, 6 Oct 2017 11:05:37 +0200	[thread overview]
Message-ID: <20171006090537.GA4325@localhost.localdomain> (raw)
In-Reply-To: <40eebf9c-611a-3924-91d9-b006738c7dee@redhat.com>

Am 06.10.2017 um 05:56 hat John Snow geschrieben:
> On 10/05/2017 07:38 AM, Kevin Wolf wrote:
> > Let me try to just consolidate all of the above into a single state
> > machine:
> > 
> > 1.  CREATED --> RUNNING
> >         driver callback: .start
> > 2a. RUNNING --> READY | CANCELLED
> >         via: auto transition (when bulk copy is finished) / block-job-cancel
> >         event: BLOCK_JOB_READY
> > 2b. READY --> READY (COMPLETING) | READY (CANCELLING)
> >         via: block-job-complete / block-job-cancel
> >         event: none
> >         driver callback: .complete / none
> > 3.  READY (CANCELLING | COMPLETING) --> DONE
> >         via: auto transition
> >              (CANCELLING: after draining in-flight mirror requests;
> >               COMPLETING: when images are in sync)
> >         event: BLOCK_JOB_DONE
> 
> I have some doubts about "DONE" necessarily coming prior to "PENDING" as
> this means that the transaction gives up control of the jobs at this
> point, and then "PENDING" jobs may complete one without the other,
> especially if we introduce a PREPARE() callback.
> 
> (At least, if I've understood you correctly that "DONE" is the phase
> where jobs queue up, ready to be dispatched by the transaction mechanism.)

Yes. This means that DONE is state where a job end up when it has
completed its work, which is generally a different point in time for
each job in the transaction. Something has to come there, and it can't
be PENDING yet because the transaction hasn't completed yet.

In other words, DONE is the inactive state that exists today, but is
externally exposed as RUNNING even though the job isn't actually doing
any work any more.

I don't see though why this means that the transaction has to give up
control?

> I think jobs needs to not clear that transactional hurdle until they've
> been allowed to call prepare so that we can be guaranteed that any
> changes that occur after that point in time will not fail (and cannot
> any longer affect the transactional group.)

The earliest point where the transaction can be removed from the picture
is the first call of block-job-finalize for any job in the transaction.
This is where all jobs of the transaction need to complete at least
their .prepare stage, otherwise this first job can't be finalised.

As we discussed yesterday, block-job-finalize is really an operation on
the whole transaction, but keeping it at the job level in the external
interface spares us managing transactions as named objects.

Kevin

  reply	other threads:[~2017-10-06  9:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-04  1:52 [Qemu-devel] [PATCH v2 0/4] blockjobs: add explicit job reaping John Snow
2017-10-04  1:52 ` [Qemu-devel] [PATCH v2 1/4] blockjob: add persistent property John Snow
2017-10-04  1:52 ` [Qemu-devel] [PATCH v2 2/4] qmp: add block-job-reap command John Snow
2017-10-04  1:52 ` [Qemu-devel] [PATCH v2 3/4] blockjob: expose persistent property John Snow
2017-10-04  1:52 ` [Qemu-devel] [PATCH v2 4/4] iotests: test manual job reaping John Snow
2017-10-04 18:27 ` [Qemu-devel] [PATCH v2 0/4] blockjobs: add explicit " Kevin Wolf
2017-10-05  1:46   ` John Snow
2017-10-05 11:38     ` Kevin Wolf
2017-10-05 18:17       ` John Snow
2017-10-09 14:30         ` Nikolay Shirokovskiy
2017-10-06  3:56       ` John Snow
2017-10-06  9:05         ` Kevin Wolf [this message]
2017-10-06  5:52       ` Markus Armbruster

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=20171006090537.GA4325@localhost.localdomain \
    --to=kwolf@redhat.com \
    --cc=famz@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=jtc@redhat.com \
    --cc=pkrempa@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).