All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Wen Congyang <wency@cn.fujitsu.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Changlong Xie <xiecl.fnst@cn.fujitsu.com>,
	Fam Zheng <famz@redhat.com>,
	zhanghailiang <zhang.zhanghailiang@huawei.com>,
	fnstml-hwcolo@cn.fujitsu.com, qemu devel <qemu-devel@nongnu.org>,
	Max Reitz <mreitz@redhat.com>, Gonglei <arei.gonglei@huawei.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v14 7/8] Implement new driver for block replication
Date: Thu, 28 Jan 2016 15:15:43 +0000	[thread overview]
Message-ID: <20160128151543.GH9825@stefanha-x1.localdomain> (raw)
In-Reply-To: <56A96B34.9090906@cn.fujitsu.com>

[-- Attachment #1: Type: text/plain, Size: 3438 bytes --]

On Thu, Jan 28, 2016 at 09:13:24AM +0800, Wen Congyang wrote:
> On 01/27/2016 10:46 PM, Stefan Hajnoczi wrote:
> > On Wed, Jan 13, 2016 at 05:18:31PM +0800, Changlong Xie wrote:
> >> +static void secondary_do_checkpoint(BDRVReplicationState *s, Error **errp)
> >> +{
> >> +    Error *local_err = NULL;
> >> +    int ret;
> >> +
> >> +    if (!s->secondary_disk->job) {
> >> +        error_setg(errp, "Backup job is cancelled unexpectedly");
> >> +        return;
> >> +    }
> >> +
> >> +    block_job_do_checkpoint(s->secondary_disk->job, &local_err);
> >> +    if (local_err) {
> >> +        error_propagate(errp, local_err);
> >> +        return;
> >> +    }
> >> +
> >> +    ret = s->active_disk->drv->bdrv_make_empty(s->active_disk);
> > 
> > What happens to in-flight requests to the active and hidden disks?
> 
> we MUST call do_checkpoint() when the vm is stopped.

Please document the environment under which the block replication
callback functions run.

I'm concerned that the bdrv_drain_all() in vm_stop() can take a long
time if the disk is slow/failing.  bdrv_drain_all() blocks until all
in-flight I/O requests have completed.  What does the Primary do if the
Secondary becomes unresponsive?

> >> +    switch (s->mode) {
> >> +    case REPLICATION_MODE_PRIMARY:
> >> +        break;
> >> +    case REPLICATION_MODE_SECONDARY:
> >> +        s->active_disk = bs->file->bs;
> >> +        if (!bs->file->bs->backing) {
> >> +            error_setg(errp, "Active disk doesn't have backing file");
> >> +            return;
> >> +        }
> >> +
> >> +        s->hidden_disk = s->active_disk->backing->bs;
> >> +        if (!s->hidden_disk->backing) {
> >> +            error_setg(errp, "Hidden disk doesn't have backing file");
> >> +            return;
> >> +        }
> >> +
> >> +        s->secondary_disk = s->hidden_disk->backing->bs;
> >> +        if (!s->secondary_disk->blk) {
> >> +            error_setg(errp, "The secondary disk doesn't have block backend");
> >> +            return;
> >> +        }
> > 
> > Kevin: Is code allowed to stash away BlockDriverState pointers for
> > convenience or should it keep the BdrvChild pointers instead?  In order
> > for replication to work as expected, the graph shouldn't change but for
> > consistency maybe BdrvChild is best.

I asked Kevin about this on IRC and he agreed that BdrvChild should be
used instead of holding on to BlockDriverState * pointers.  Although
these pointers will not change during replication (if the op blockers
are set up correctly), it's more consistent and certainly safer to go
through BdrvChild.

> >> +        /* start backup job now */
> >> +        error_setg(&s->blocker,
> >> +                   "block device is in use by internal backup job");
> >> +        bdrv_op_block_all(s->top_bs, s->blocker);
> >> +        bdrv_op_unblock(s->top_bs, BLOCK_OP_TYPE_DATAPLANE, s->blocker);
> >> +        bdrv_ref(s->hidden_disk);
> > 
> > Why is the explicit reference to hidden_disk (but not secondary_disk or
> > active_disk) is necessary?
> 
> IIRC, we should reference the backup target before calling backup_start(),
> and we will reference the backup source in backup_start().

I'm not sure why this is necessary since they are part of the backing
chain.

If it is necessary, please add a comment so it's clear why the reference
is being taken.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2016-01-28 15:15 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-13  9:18 [Qemu-devel] [PATCH v14 0/8] Block replication for continuous checkpoints Changlong Xie
2016-01-13  9:18 ` [Qemu-devel] [PATCH v14 1/8] unblock backup operations in backing file Changlong Xie
2016-01-13  9:18 ` [Qemu-devel] [PATCH v14 2/8] Store parent BDS in BdrvChild Changlong Xie
2016-01-13  9:18 ` [Qemu-devel] [PATCH v14 3/8] Backup: clear all bitmap when doing block checkpoint Changlong Xie
2016-01-27 16:05   ` Stefan Hajnoczi
2016-01-28  2:22     ` Changlong Xie
2016-01-13  9:18 ` [Qemu-devel] [PATCH v14 4/8] Allow creating backup jobs when opening BDS Changlong Xie
2016-01-27 14:04   ` Stefan Hajnoczi
2016-01-28  2:22     ` Changlong Xie
2016-01-13  9:18 ` [Qemu-devel] [PATCH v14 5/8] docs: block replication's description Changlong Xie
2016-02-02 15:20   ` Eric Blake
2016-02-03  3:18     ` Changlong Xie
2016-02-03  3:35       ` Eric Blake
2016-02-03  3:40         ` Wen Congyang
2016-01-13  9:18 ` [Qemu-devel] [PATCH v14 6/8] auto complete active commit Changlong Xie
2016-01-13  9:18 ` [Qemu-devel] [PATCH v14 7/8] Implement new driver for block replication Changlong Xie
2016-01-20  0:04   ` Eric Blake
2016-01-20  7:45     ` Changlong Xie
2016-01-27 14:46   ` Stefan Hajnoczi
2016-01-28  1:13     ` Wen Congyang
2016-01-28 15:15       ` Stefan Hajnoczi [this message]
2016-01-29  3:13         ` Changlong Xie
2016-01-29 15:46           ` Stefan Hajnoczi
2016-02-01  1:13             ` Wen Congyang
2016-02-02 14:34               ` Stefan Hajnoczi
2016-02-03  1:29                 ` Wen Congyang
2016-02-03  9:32                   ` Stefan Hajnoczi
2016-02-03  9:55                     ` Wen Congyang
2016-02-03 11:25                       ` Hailiang Zhang
2016-01-13  9:18 ` [Qemu-devel] [PATCH v14 8/8] support replication driver in blockdev-add Changlong Xie
2016-01-14  1:12 ` [Qemu-devel] [PATCH v14 0/8] Block replication for continuous checkpoints Changlong Xie
2016-01-19  1:27   ` Hailiang Zhang
2016-01-24 13:34 ` Wen Congyang
2016-01-26 16:04   ` Stefan Hajnoczi

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=20160128151543.GH9825@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=famz@redhat.com \
    --cc=fnstml-hwcolo@cn.fujitsu.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wency@cn.fujitsu.com \
    --cc=xiecl.fnst@cn.fujitsu.com \
    --cc=zhang.zhanghailiang@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.