From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37500) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bS535-0001dT-Kq for qemu-devel@nongnu.org; Tue, 26 Jul 2016 12:17:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bS534-0001mq-Es for qemu-devel@nongnu.org; Tue, 26 Jul 2016 12:17:39 -0400 References: <1469520941-16283-1-git-send-email-xiecl.fnst@cn.fujitsu.com> <1469520941-16283-10-git-send-email-xiecl.fnst@cn.fujitsu.com> From: Max Reitz Message-ID: <38640520-a66b-fe88-2b69-9060a3483dab@redhat.com> Date: Tue, 26 Jul 2016 18:17:27 +0200 MIME-Version: 1.0 In-Reply-To: <1469520941-16283-10-git-send-email-xiecl.fnst@cn.fujitsu.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Sg1hTujXjE80Bu21maIVPE7RhVJevXAgS" Subject: Re: [Qemu-devel] [PATCH v23 09/12] Implement new driver for block replication List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Changlong Xie , qemu devel , qemu block , Stefan Hajnoczi , Fam Zheng , Kevin Wolf , Jeff Cody Cc: Paolo Bonzini , John Snow , Eric Blake , Markus Armbruster , "Dr. David Alan Gilbert" , Dong Eddie , Jiang Yunhong , zhanghailiang , Gonglei , Wen Congyang , Wang Weiwei This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Sg1hTujXjE80Bu21maIVPE7RhVJevXAgS From: Max Reitz To: Changlong Xie , qemu devel , qemu block , Stefan Hajnoczi , Fam Zheng , Kevin Wolf , Jeff Cody Cc: Paolo Bonzini , John Snow , Eric Blake , Markus Armbruster , "Dr. David Alan Gilbert" , Dong Eddie , Jiang Yunhong , zhanghailiang , Gonglei , Wen Congyang , Wang Weiwei Message-ID: <38640520-a66b-fe88-2b69-9060a3483dab@redhat.com> Subject: Re: [PATCH v23 09/12] Implement new driver for block replication References: <1469520941-16283-1-git-send-email-xiecl.fnst@cn.fujitsu.com> <1469520941-16283-10-git-send-email-xiecl.fnst@cn.fujitsu.com> In-Reply-To: <1469520941-16283-10-git-send-email-xiecl.fnst@cn.fujitsu.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 26.07.2016 10:15, Changlong Xie wrote: > From: Wen Congyang >=20 > Signed-off-by: Wen Congyang > Signed-off-by: Changlong Xie > Signed-off-by: Wang WeiWei > Signed-off-by: zhanghailiang > Signed-off-by: Gonglei > --- > block/Makefile.objs | 1 + > block/replication.c | 658 ++++++++++++++++++++++++++++++++++++++++++++= ++++++++ > 2 files changed, 659 insertions(+) > create mode 100644 block/replication.c [...] > diff --git a/block/replication.c b/block/replication.c > new file mode 100644 > index 0000000..ec35348 > --- /dev/null > +++ b/block/replication.c > @@ -0,0 +1,658 @@ [...] > +static void replication_start(ReplicationState *rs, ReplicationMode mo= de, > + Error **errp) > +{ [...] > + /* start backup job now */ > + error_setg(&s->blocker, > + "Block device is in use by internal backup job"); > + > + top_bs =3D bdrv_lookup_bs(s->top_id, s->top_id, errp); I think you should pass NULL instead of errp... > + if (!top_bs || !check_top_bs(top_bs, bs)) { > + error_setg(errp, "No top_bs or it is invalid"); =2E..or if you don't, then you should not call this function if top_bs is= NULL. Otherwise you'll probably get a failed assertion in error_setv() because *errp is not NULL. > + reopen_backing_file(s, false, NULL); > + aio_context_release(aio_context); > + return; > + } > + bdrv_op_block_all(top_bs, s->blocker); > + bdrv_op_unblock(top_bs, BLOCK_OP_TYPE_DATAPLANE, s->blocker); Shouldn't you make sure that top_bs is a root node? The first patch in Kevin's "block: Accept node-name in all node level QMP commands" series introduces the bdrv_is_root_node() function for that purpose. Maybe that check should be put into check_top_bs(). Max > + > + backup_start("replication-backup", s->secondary_disk->bs, > + s->hidden_disk->bs, 0, MIRROR_SYNC_MODE_NONE, NUL= L, > + BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPOR= T, > + backup_job_completed, s, NULL, &local_err); > + if (local_err) { > + error_propagate(errp, local_err); > + backup_job_cleanup(s); > + aio_context_release(aio_context); > + return; > + } > + break; --Sg1hTujXjE80Bu21maIVPE7RhVJevXAgS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEvBAEBCAAZBQJXl40XEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrUue B/oDWI5+aRO+Q+iy7XIFbxIrftZrfBX592ztVGzG/uGIGz4MGWSTt6hLrwTlkSjh NWIYutI0agpUg62N0Imea6L+prpba8xQ9soYlp1pQrmv54ecmwWIYuOQctRGPOSI sfB27hFB8HEXFAIAeZQSzOl+0aG0HxmUf9MBGCFMvROTpxGnqooj05ccLu4goMhd cxGwGzwsXCYfLZR+HXiBbBUycX1HcA+FJagHFYkWiCniKwYpgvxBhbXwzghKpBYW 8Je3ANZ0ZL2rXbOwXNWtHegqPR4iSVXlGOhBEc9Lu4AG6qGbDT5dab85/R19ZDsa gzWZ2r2RyQgeKGigo9i8E7yz =kG5M -----END PGP SIGNATURE----- --Sg1hTujXjE80Bu21maIVPE7RhVJevXAgS--