From: Stefan Hajnoczi <stefanha@gmail.com>
To: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Fam Zheng <famz@redhat.com>,
zhanghailiang <zhang.zhanghailiang@huawei.com>,
qemu block <qemu-block@nongnu.org>,
Jiang Yunhong <yunhong.jiang@intel.com>,
Dong Eddie <eddie.dong@intel.com>,
qemu devel <qemu-devel@nongnu.org>,
"Michael R. Hines" <mrhines@linux.vnet.ibm.com>,
Max Reitz <mreitz@redhat.com>, Gonglei <arei.gonglei@huawei.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v15 8/9] Implement new driver for block replication
Date: Fri, 4 Mar 2016 17:39:54 +0000 [thread overview]
Message-ID: <20160304173954.GF9130@stefanha-x1.localdomain> (raw)
In-Reply-To: <1454645888-28826-9-git-send-email-xiecl.fnst@cn.fujitsu.com>
[-- Attachment #1: Type: text/plain, Size: 1968 bytes --]
On Fri, Feb 05, 2016 at 12:18:07PM +0800, Changlong Xie wrote:
> +static void replication_start(ReplicationState *rs, ReplicationMode mode,
> + Error **errp)
> +{
> + BlockDriverState *bs = rs->opaque;
> + BDRVReplicationState *s = bs->opaque;
> + int64_t active_length, hidden_length, disk_length;
> + AioContext *aio_context;
> + Error *local_err = NULL;
> +
> + if (s->replication_state != BLOCK_REPLICATION_NONE) {
Dereferencing bs and s is not thread-safe since the AioContext isn't
acquired here. Unless you have other locking rules, the default is that
everything in BlockDriverState and bs->opaque must be accessed with the
AioContext acquired.
Please apply this comment to the rest of the patch series, too.
Functions that are not part of BlockDriver are probably called outside
the AioContext and must acquire it before they are allowed to access
anything else in bs.
> + s->top_bs = get_top_bs(bs);
> + if (!s->top_bs) {
> + error_setg(errp, "Cannot get the top block driver state to do"
> + " internal backup");
> + return;
> + }
Traversing the BDS graph using the parent pointer is not safe - you
cannot stash the parent pointer because it changes if a parent node is
inserted/removed.
I suggest passing the drive name as an argument so that bdrv_lookup_bs()
can be used when installing the op blocker. Then the BdrvChild.parent
pointer patch and get_top_bs() can be deleted.
Jeff Cody is currently working on a new op blocker system. Hopefully
this system will allow you to install blockers on bs instead of on the
drive's top BDS. But let's not worry about that for now and just use
the drive name as an argument.
> + /*
> + * Must protect backup target if backup job was stopped/cancelled
> + * unexpectedly
> + */
> + bdrv_ref(s->hidden_disk->bs);
Where is the matching bdrv_unref() call?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2016-03-04 17:40 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-05 4:17 [Qemu-devel] [PATCH v15 0/9] Block replication for continuous checkpoints Changlong Xie
2016-02-05 4:18 ` [Qemu-devel] [PATCH v15 1/9] unblock backup operations in backing file Changlong Xie
2016-02-05 4:18 ` [Qemu-devel] [PATCH v15 2/9] Store parent BDS in BdrvChild Changlong Xie
2016-02-05 4:18 ` [Qemu-devel] [PATCH v15 3/9] Backup: clear all bitmap when doing block checkpoint Changlong Xie
2016-02-05 4:18 ` [Qemu-devel] [PATCH v15 4/9] Link backup into block core Changlong Xie
2016-02-05 4:18 ` [Qemu-devel] [PATCH v15 5/9] docs: block replication's description Changlong Xie
2016-02-05 4:18 ` [Qemu-devel] [PATCH v15 6/9] auto complete active commit Changlong Xie
2016-02-05 4:18 ` [Qemu-devel] [PATCH v15 7/9] Introduce new APIs to do replication operation Changlong Xie
2016-02-15 0:57 ` Hailiang Zhang
2016-02-15 1:13 ` Wen Congyang
2016-02-19 8:41 ` Hailiang Zhang
2016-02-19 8:55 ` Wen Congyang
2016-02-15 2:25 ` Changlong Xie
2016-03-04 16:13 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2016-03-08 3:08 ` Changlong Xie
2016-02-05 4:18 ` [Qemu-devel] [PATCH v15 8/9] Implement new driver for block replication Changlong Xie
2016-03-04 17:39 ` Stefan Hajnoczi [this message]
2016-03-08 3:30 ` Changlong Xie
2016-03-09 3:29 ` Changlong Xie
2016-03-04 17:53 ` Stefan Hajnoczi
2016-03-08 3:31 ` Changlong Xie
2016-03-09 10:35 ` Changlong Xie
2016-02-05 4:18 ` [Qemu-devel] [PATCH v15 9/9] support replication driver in blockdev-add Changlong Xie
2016-02-15 7:02 ` [Qemu-devel] [PATCH v15 0/9] Block replication for continuous checkpoints Changlong Xie
2016-02-17 9:32 ` Hailiang Zhang
2016-02-23 9:10 ` Changlong Xie
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=20160304173954.GF9130@stefanha-x1.localdomain \
--to=stefanha@gmail.com \
--cc=arei.gonglei@huawei.com \
--cc=dgilbert@redhat.com \
--cc=eddie.dong@intel.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=mrhines@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=xiecl.fnst@cn.fujitsu.com \
--cc=yunhong.jiang@intel.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 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).