From: Fam Zheng <famz@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: John Snow <jsnow@redhat.com>,
qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-block] Making QMP 'block-job-cancel' transactionable
Date: Wed, 12 Apr 2017 17:12:39 +0800 [thread overview]
Message-ID: <20170412091239.GA8607@lemon> (raw)
In-Reply-To: <20170412085931.GA4955@noname.str.redhat.com>
On Wed, 04/12 10:59, Kevin Wolf wrote:
> Am 12.04.2017 um 10:42 hat Fam Zheng geschrieben:
> > On Tue, 04/11 15:30, Kevin Wolf wrote:
> > > Am 11.04.2017 um 15:14 hat Eric Blake geschrieben:
> > > > On 04/11/2017 07:05 AM, Kevin Wolf wrote:
> > > > > Note that job completion/cancellation aren't synchronous QMP commands.
> > > > > The job works something like this, where '...' means that the VM can run
> > > > > and submit new writes etc.:
> > > > >
> > > > > 1. Start job: mirror_start
> > > > > ...
> > > > > 2. Bulk has completed: BLOCK_JOB_READY event
> > > > > ...
> > > > > 3. Request completion/cancellation: block-job-completet/cancel
> > > > > ...
> > > > > 4. Actual completion/cancellation: BLOCK_JOB_COMPLETED
> > > > >
> > > > > The last one is the actual job completion that we want to be atomic for
> > > > > a group of nodes. Just making step 3 atomic (which is what including
> > > > > block-job-complete/cancel in transaction would mean) doesn't really buy
> > > > > us anything because the data will still change between step 3 and 4.
> > > >
> > > > But as long as the data changes between steps 3 and 4 are written to
> > > > only one of the two devices, rather than both, then the disk contents
> > > > atomicity is guaranteed at the point where we stopped the mirroring (ie.
> > > > during step 3).
> > >
> > > But that's not how things work. Essentially requesting completion means
> > > that the next time that source and target are in sync, we complete the
> > > block job. This means that still new copying requests can be issued
> > > before the job actually completes (and it's even likely to happen).
> > >
> > > > > Now step 4 is reached for each job individually, and unless you stop the
> > > > > VM (or at least the processing of I/O requests), I don't see how you
> > > > > could reach it at the same time for all jobs.
> > > >
> > > > The fact that the jobs complete independently (based on different
> > > > amounts of data to flush) is not problematic, if we are still guaranteed
> > > > that issuing the request altered the graph so that future writes by the
> > > > guest only go to one side, and the delay in closing is only due to
> > > > flushing write requests that pre-dated the job end request.
> > >
> > > This is not easily possible without implementing something like a backup
> > > job for the final stage of the mirror job... Otherwise the guest can
> > > always overwrite a sector that is still marked dirty and then that new
> > > sector will definitely be copied still.
> >
> > We can add a block-job-cancel-sync command and call block_job_cancel_sync(). If
> > added to transaction, this does what Eric is asking, right?
>
> But why is this better than issuing an explicit stop/cont? The VM will
> still be stopped for the same time, but additionally the monitor will
> block and the qemu process won't be responsive until the job has
> completed.
In practice I don't expect block_job_cancel_sync to be "long running", I expect
it in the order of a few bdrv_flush() time, which is not worse than the block
job starting commands. (I agree that block-job-complete-sync would be
very different.)
Fam
prev parent reply other threads:[~2017-04-12 9:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-24 12:34 [Qemu-devel] Making QMP 'block-job-cancel' transactionable Kashyap Chamarthy
2017-03-28 14:49 ` Eric Blake
2017-03-28 15:29 ` Kashyap Chamarthy
2017-04-03 14:38 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2017-04-03 20:29 ` John Snow
2017-04-03 20:38 ` Eric Blake
2017-04-04 13:28 ` Kashyap Chamarthy
2017-04-04 13:54 ` Eric Blake
2017-04-11 9:42 ` Markus Armbruster
2017-04-11 10:30 ` Kashyap Chamarthy
2017-04-11 12:05 ` Kevin Wolf
2017-04-11 13:14 ` Eric Blake
2017-04-11 13:30 ` Kevin Wolf
2017-04-12 8:42 ` Fam Zheng
2017-04-12 8:59 ` Kevin Wolf
2017-04-12 9:12 ` Fam Zheng [this message]
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=20170412091239.GA8607@lemon \
--to=famz@redhat.com \
--cc=jsnow@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).