From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNP4n-00083F-4a for qemu-devel@nongnu.org; Fri, 29 Aug 2014 12:31:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XNP4i-0002wF-Is for qemu-devel@nongnu.org; Fri, 29 Aug 2014 12:31:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20588) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNP4i-0002w4-Az for qemu-devel@nongnu.org; Fri, 29 Aug 2014 12:30:56 -0400 From: Stefan Hajnoczi Date: Fri, 29 Aug 2014 17:29:50 +0100 Message-Id: <1409329803-20744-23-git-send-email-stefanha@redhat.com> In-Reply-To: <1409329803-20744-1-git-send-email-stefanha@redhat.com> References: <1409329803-20744-1-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 22/35] sheepdog: fix a core dump while do auto-reconnecting List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Peter Maydell , Markus Armbruster , Stefan Hajnoczi , Liu Yuan From: Liu Yuan We should reinit local_err as NULL inside the while loop or g_free() will= report corrupption and abort the QEMU when sheepdog driver tries reconnecting. This was broken in commit 356b4ca. qemu-system-x86_64: failed to get the header, Resource temporarily unavai= lable qemu-system-x86_64: Failed to connect to socket: Connection refused qemu-system-x86_64: (null) [xcb] Unknown sequence number while awaiting reply [xcb] Most likely this is a multi-threaded client and XInitThreads has no= t been called [xcb] Aborting, sorry about that. qemu-system-x86_64: ../../src/xcb_io.c:298: poll_for_response: Assertion = `!xcb_xlib_threads_sequence_lost' failed. Aborted (core dumped) Cc: qemu-devel@nongnu.org Cc: Markus Armbruster Cc: Kevin Wolf Cc: Stefan Hajnoczi Reviewed-by: Markus Armbruster Signed-off-by: Liu Yuan Reviewed-by: Beno=C3=AEt Canet Signed-off-by: Stefan Hajnoczi --- block/sheepdog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/sheepdog.c b/block/sheepdog.c index 49a9a9e..f91afc3 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -716,7 +716,6 @@ static void coroutine_fn send_pending_req(BDRVSheepdo= gState *s, uint64_t oid) =20 static coroutine_fn void reconnect_to_sdog(void *opaque) { - Error *local_err =3D NULL; BDRVSheepdogState *s =3D opaque; AIOReq *aio_req, *next; =20 @@ -731,6 +730,7 @@ static coroutine_fn void reconnect_to_sdog(void *opaq= ue) =20 /* Try to reconnect the sheepdog server every one second. */ while (s->fd < 0) { + Error *local_err =3D NULL; s->fd =3D get_sheep_fd(s, &local_err); if (s->fd < 0) { DPRINTF("Wait for connection to be established\n"); --=20 1.9.3