qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu block <qemu-block@nongnu.org>
Cc: Kevin Wolf <kwolf@redhat.com>, "Denis V. Lunev" <den@openvz.org>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: about mirror cancel
Date: Fri, 16 Apr 2021 09:05:23 +0200	[thread overview]
Message-ID: <5df8166f-a204-6510-e27a-1b334f0bb3f3@redhat.com> (raw)
In-Reply-To: <b2e5b990-ca1c-53f0-0e0c-31396156fa4a@virtuozzo.com>

On 15.04.21 20:46, Vladimir Sementsov-Ogievskiy wrote:
> Hi all!
> 
> Recently I've implemented fast-cancelling of mirror job: do 
> bdrv_cancel_in_flight() in mirror_cancel().
> 
> Now I'm in doubt: is it a correct thing? I heard, that mirror-cancel is 
> a kind of valid mirror completion..
> 
> Looking at documentation:
> 
> # Note that if you issue 'block-job-cancel' after 'drive-mirror' has 
> indicated
> # (via the event BLOCK_JOB_READY) that the source and destination are
> # synchronized, then the event triggered by this command changes to
> # BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
> # destination now has a point-in-time copy tied to the time of the 
> cancellation.
> 
> So, in other words, do we guarantee something to the user, if it calls 
> mirror-cancel in ready state? Does this abuse exist in libvirt?

How is it abuse it if it’s documented?  AFAIR it does exist, because 
libvirt’s blockcopy always uses mirror (with --pivot it’s allowed to 
complete, without it is cancelled).

(And the point of course is that if you want mirror to create a copy 
without pivoting, you need this behavior, because otherwise the target 
may be in an inconsistent state.)

> ====
> 
> Note, that if cancelling all in-flight requests on target is wrong on 
> mirror cancel, we still don't have real bug, as the only implementation 
> of .bdrv_cancel_in_flight is stopping reconnect waiting in nbd driver. 
> So, we'll cancel requests only if connection is already lost anyway.
> 
> But that probably means, that correct name of the handler would be 
> .bdrv_cancel_in_fligth_requests_that_will_most_probably_fail_anyway()..

It’s documentation states that it should cancel all in-flight requests, 
so it’s more likely it just isn’t implemented where it could be.

> And it also means, that abuse of mirror-cancel as valid completion is a 
> bad idea, as we can't distinguish the cases when user calls job-cancel 
> to have a kind of point-in-time copy, or just to cancel job (and being 
> not interested in the final state of target).
> 
> So, probably we need an option boolean argument for blockjob-cancel, 
> like "hard", that will cancel in-flight writes on target node..

There is @force.  See commit b76e4458b1eb3c3.

Max



  reply	other threads:[~2021-04-16  7:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-15 18:46 about mirror cancel Vladimir Sementsov-Ogievskiy
2021-04-16  7:05 ` Max Reitz [this message]
2021-04-16  7:11   ` Max Reitz
2021-04-16  7:45     ` Vladimir Sementsov-Ogievskiy

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=5df8166f-a204-6510-e27a-1b334f0bb3f3@redhat.com \
    --to=mreitz@redhat.com \
    --cc=den@openvz.org \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.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).