render / rpms / libvirt

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