[Pkg-libvirt-commits] [SCM] VirtViewer Debian packaging branch, master, updated. debian/0.4.1-3

Guido Günther agx at sigxcpu.org
Tue Aug 16 16:13:14 UTC 2011


The following commit has been merged in the master branch:
commit 9e79afb69a4f133b6ad3a93c0e3a48ffb5eb853b
Author: Guido Günther <agx at sigxcpu.org>
Date:   Tue Aug 16 18:06:07 2011 +0200

    ff callbacks must be invoked from a clean stack.
    
    Fixes a hang when connecting to an unknown host or wrong port.

diff --git a/debian/patches/0002-ff-callbacks-must-be-invoked-from-a-clean-stack.patch b/debian/patches/0002-ff-callbacks-must-be-invoked-from-a-clean-stack.patch
new file mode 100644
index 0000000..d5f83a2
--- /dev/null
+++ b/debian/patches/0002-ff-callbacks-must-be-invoked-from-a-clean-stack.patch
@@ -0,0 +1,96 @@
+From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx at sigxcpu.org>
+Date: Tue, 16 Aug 2011 08:36:13 -0700
+Subject: ff callbacks must be invoked from a clean stack
+
+If 'ff' callbacks are invoked directly from the remove
+callback they will likely deadlock in libvirt. They must
+be invoked from a clean stack, so switch to using a
+glib idle callback.
+---
+ src/virt-viewer-events.c |   47 ++++++++++++++++++++++++++++++++++++++-------
+ 1 files changed, 39 insertions(+), 8 deletions(-)
+
+diff --git a/src/virt-viewer-events.c b/src/virt-viewer-events.c
+index 108f97d..87df739 100644
+--- a/src/virt-viewer-events.c
++++ b/src/virt-viewer-events.c
+@@ -160,6 +160,23 @@ virt_viewer_events_update_handle(int watch,
+     }
+ }
+ 
++
++static gboolean
++virt_viewer_events_cleanup_handle(gpointer user_data)
++{
++    struct virt_viewer_events_handle *data = user_data;
++
++    DEBUG_LOG("Cleanup of handle %p", data);
++    g_return_val_if_fail(data != NULL, FALSE);
++
++    if (data->ff)
++        (data->ff)(data->opaque);
++
++    free(data);
++    return FALSE;
++}
++
++
+ static int
+ virt_viewer_events_remove_handle(int watch)
+ {
+@@ -172,13 +189,14 @@ virt_viewer_events_remove_handle(int watch)
+ 
+     DEBUG_LOG("Remove handle %d %d", watch, data->fd);
+ 
++    if (!data->source)
++        return -1;
++
+     g_source_remove(data->source);
+     data->source = 0;
+     data->events = 0;
+-    if (data->ff)
+-        (data->ff)(data->opaque);
+-    free(data);
+ 
++    g_idle_add(virt_viewer_events_cleanup_handle, data);
+     return 0;
+ }
+ 
+@@ -279,6 +297,23 @@ virt_viewer_events_update_timeout(int timer,
+     }
+ }
+ 
++
++static gboolean
++virt_viewer_events_cleanup_timeout(gpointer user_data)
++{
++    struct virt_viewer_events_timeout *data = user_data;
++
++    DEBUG_LOG("Cleanup of timeout %p", data);
++    g_return_val_if_fail(data != NULL, FALSE);
++
++    if (data->ff)
++        (data->ff)(data->opaque);
++
++    free(data);
++    return FALSE;
++}
++
++
+ static int
+ virt_viewer_events_remove_timeout(int timer)
+ {
+@@ -297,11 +332,7 @@ virt_viewer_events_remove_timeout(int timer)
+     g_source_remove(data->source);
+     data->source = 0;
+ 
+-    if (data->ff)
+-        (data->ff)(data->opaque);
+-
+-    free(data);
+-
++    g_idle_add(virt_viewer_events_cleanup_timeout, data);
+     return 0;
+ }
+ 
+-- 
diff --git a/debian/patches/series b/debian/patches/series
index 0a337f3..dcd2d88 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 0001-Really-fix-using-alternate-ssh-ports.patch
+0002-ff-callbacks-must-be-invoked-from-a-clean-stack.patch

-- 
VirtViewer Debian packaging



More information about the Pkg-libvirt-commits mailing list