render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
d0f569
From b550b671bace6d979a0763a837ce97ddf72e8fc8 Mon Sep 17 00:00:00 2001
d0f569
Message-Id: <b550b671bace6d979a0763a837ce97ddf72e8fc8@dist-git>
d0f569
From: Martin Kletzander <mkletzan@redhat.com>
d0f569
Date: Fri, 28 Jan 2022 20:33:12 +0100
d0f569
Subject: [PATCH] RHEL: Remove 
d0f569
d0f569
https://bugzilla.redhat.com/show_bug.cgi?id=2045879
d0f569
d0f569
This is to accommodate for RHEL 8 downstream glib being fixed with a backport in
d0f569
version 2.56.4-12 (Bug 1948988).  Another reason for that is that our workaround
d0f569
does not play nice with a fixed glib, leading to libvirt not properly
d0f569
dereferencing the monitor socket, eventually leading to EMFILE: Too many open
d0f569
files.
d0f569
d0f569
RHEL-only
d0f569
d0f569
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
d0f569
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
d0f569
---
d0f569
 src/util/glibcompat.c | 46 ++++++++-----------------------------------
d0f569
 1 file changed, 8 insertions(+), 38 deletions(-)
d0f569
d0f569
diff --git a/src/util/glibcompat.c b/src/util/glibcompat.c
d0f569
index eb6dcc0111..bf890f10d2 100644
d0f569
--- a/src/util/glibcompat.c
d0f569
+++ b/src/util/glibcompat.c
d0f569
@@ -212,51 +212,21 @@ vir_g_strdup_vprintf(const char *msg, va_list args)
d0f569
     return ret;
d0f569
 }
d0f569
 
d0f569
-
d0f569
 /*
d0f569
- * If the last reference to a GSource is released in a non-main
d0f569
- * thread we're exposed to a race condition that causes a
d0f569
- * crash:
d0f569
- *
d0f569
- *    https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1358
d0f569
+ * This is a leftover of a hack that works around glib older than 2.64.0, but
d0f569
+ * the fix in glib as backported in RHEL-8 to glib2-2.56.4-12 in BZ 1948988:
d0f569
  *
d0f569
- * Thus we're using an idle func to release our ref...
d0f569
+ *   https://bugzilla.redhat.com/show_bug.cgi?id=1948988
d0f569
  *
d0f569
- * ...but this imposes a significant performance penalty on
d0f569
- * I/O intensive workloads which are sensitive to the iterations
d0f569
- * of the event loop, so avoid the workaround if we know we have
d0f569
- * new enough glib.
d0f569
+ * and our workaround coupled with that glib fix started causing leaks, which
d0f569
+ * surfaced with us not unreferencing the qemu monitor socket in BZ 2045879:
d0f569
  *
d0f569
- * The function below is used from a header file definition.
d0f569
+ *   https://bugzilla.redhat.com/show_bug.cgi?id=2045879
d0f569
  *
d0f569
- * Drop when min glib >= 2.64.0
d0f569
+ * Keeping this wrapper makes it easier to follow with other backports without
d0f569
+ * conflicts in callers due to the function name change.
d0f569
  */
d0f569
-#if GLIB_CHECK_VERSION(2, 64, 0)
d0f569
 void vir_g_source_unref(GSource *src, GMainContext *ctx G_GNUC_UNUSED)
d0f569
 {
d0f569
     g_source_unref(src);
d0f569
 }
d0f569
-#else
d0f569
-
d0f569
-static gboolean
d0f569
-virEventGLibSourceUnrefIdle(gpointer data)
d0f569
-{
d0f569
-    GSource *src = data;
d0f569
-
d0f569
-    g_source_unref(src);
d0f569
-
d0f569
-    return FALSE;
d0f569
-}
d0f569
-
d0f569
-void vir_g_source_unref(GSource *src, GMainContext *ctx)
d0f569
-{
d0f569
-    GSource *idle = g_idle_source_new();
d0f569
-
d0f569
-    g_source_set_callback(idle, virEventGLibSourceUnrefIdle, src, NULL);
d0f569
-
d0f569
-    g_source_attach(idle, ctx);
d0f569
-
d0f569
-    g_source_unref(idle);
d0f569
-}
d0f569
-
d0f569
-#endif
d0f569
-- 
d0f569
2.35.1
d0f569