qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] sheepdog: fix a core dump while do auto-reconnecting
@ 2014-08-28 10:27 Liu Yuan
  2014-08-28 14:50 ` Benoît Canet
  2014-08-29  9:04 ` Stefan Hajnoczi
  0 siblings, 2 replies; 3+ messages in thread
From: Liu Yuan @ 2014-08-28 10:27 UTC (permalink / raw)
  To: sheepdog; +Cc: Kevin Wolf, qemu-devel, Stefan Hajnoczi, Markus Armbruster

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 unavailable
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 not 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 <armbru@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
---
 block/sheepdog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/sheepdog.c b/block/sheepdog.c
index 12cbd9d..53c24d6 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -712,7 +712,6 @@ static void coroutine_fn send_pending_req(BDRVSheepdogState *s, uint64_t oid)
 
 static coroutine_fn void reconnect_to_sdog(void *opaque)
 {
-    Error *local_err = NULL;
     BDRVSheepdogState *s = opaque;
     AIOReq *aio_req, *next;
 
@@ -727,6 +726,7 @@ static coroutine_fn void reconnect_to_sdog(void *opaque)
 
     /* Try to reconnect the sheepdog server every one second. */
     while (s->fd < 0) {
+        Error *local_err = NULL;
         s->fd = get_sheep_fd(s, &local_err);
         if (s->fd < 0) {
             DPRINTF("Wait for connection to be established\n");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] sheepdog: fix a core dump while do auto-reconnecting
  2014-08-28 10:27 [Qemu-devel] [PATCH v2] sheepdog: fix a core dump while do auto-reconnecting Liu Yuan
@ 2014-08-28 14:50 ` Benoît Canet
  2014-08-29  9:04 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Benoît Canet @ 2014-08-28 14:50 UTC (permalink / raw)
  To: Liu Yuan
  Cc: Kevin Wolf, sheepdog, qemu-devel, Stefan Hajnoczi,
	Markus Armbruster

The Thursday 28 Aug 2014 à 18:27:55 (+0800), Liu Yuan wrote :
> 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 unavailable
> 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 not 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 <armbru@redhat.com>
> Cc: Kevin Wolf <kwolf@redhat.com>
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
> Reviewed-by: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Liu Yuan <namei.unix@gmail.com>
> ---
>  block/sheepdog.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/sheepdog.c b/block/sheepdog.c
> index 12cbd9d..53c24d6 100644
> --- a/block/sheepdog.c
> +++ b/block/sheepdog.c
> @@ -712,7 +712,6 @@ static void coroutine_fn send_pending_req(BDRVSheepdogState *s, uint64_t oid)
>  
>  static coroutine_fn void reconnect_to_sdog(void *opaque)
>  {
> -    Error *local_err = NULL;
>      BDRVSheepdogState *s = opaque;
>      AIOReq *aio_req, *next;
>  
> @@ -727,6 +726,7 @@ static coroutine_fn void reconnect_to_sdog(void *opaque)
>  
>      /* Try to reconnect the sheepdog server every one second. */
>      while (s->fd < 0) {
> +        Error *local_err = NULL;
>          s->fd = get_sheep_fd(s, &local_err);
>          if (s->fd < 0) {
>              DPRINTF("Wait for connection to be established\n");
> -- 
> 1.9.1
> 
> 

I am not a sheepdog expert but from the code it looks good.

Reviewed-by: Benoît Canet <benoit.canet@nodalink.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] sheepdog: fix a core dump while do auto-reconnecting
  2014-08-28 10:27 [Qemu-devel] [PATCH v2] sheepdog: fix a core dump while do auto-reconnecting Liu Yuan
  2014-08-28 14:50 ` Benoît Canet
@ 2014-08-29  9:04 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2014-08-29  9:04 UTC (permalink / raw)
  To: Liu Yuan; +Cc: Kevin Wolf, sheepdog, qemu-devel, Markus Armbruster

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

On Thu, Aug 28, 2014 at 06:27:55PM +0800, Liu Yuan wrote:
> 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 unavailable
> 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 not 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 <armbru@redhat.com>
> Cc: Kevin Wolf <kwolf@redhat.com>
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
> Reviewed-by: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Liu Yuan <namei.unix@gmail.com>
> ---
>  block/sheepdog.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-08-29  9:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-28 10:27 [Qemu-devel] [PATCH v2] sheepdog: fix a core dump while do auto-reconnecting Liu Yuan
2014-08-28 14:50 ` Benoît Canet
2014-08-29  9:04 ` Stefan Hajnoczi

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).