Blame SOURCES/0003-generator-Print-a-better-error-message-if-connect-2-.patch

362730
From f094472efcf34cea8bf1f02a1c5c9442ffc4ca53 Mon Sep 17 00:00:00 2001
362730
From: "Richard W.M. Jones" <rjones@redhat.com>
362730
Date: Thu, 4 Feb 2021 18:02:46 +0000
362730
Subject: [PATCH] generator: Print a better error message if connect(2) returns
362730
 EAGAIN.
362730
362730
The new error message is:
362730
362730
nbd_connect_unix: connect: server backlog overflowed, see https://bugzilla.redhat.com/1925045: Resource temporarily unavailable
362730
362730
Fixes: https://bugzilla.redhat.com/1925045
362730
Thanks: Xin Long, Lukas Doktor, Eric Blake
362730
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
362730
(cherry picked from commit 85ed74960a658a82d7b61b0be07f43d1b2dcede9)
362730
---
362730
 generator/states-connect.c | 16 ++++++++++++++++
362730
 1 file changed, 16 insertions(+)
362730
362730
diff --git a/generator/states-connect.c b/generator/states-connect.c
362730
index 03b34c7..98c26e5 100644
362730
--- a/generator/states-connect.c
362730
+++ b/generator/states-connect.c
362730
@@ -70,6 +70,22 @@ STATE_MACHINE {
362730
   if (r == 0 || (r == -1 && errno == EINPROGRESS))
362730
     return 0;
362730
   assert (r == -1);
362730
+#ifdef __linux__
362730
+  if (errno == EAGAIN && family == AF_UNIX) {
362730
+    /* This can happen on Linux when connecting to a Unix domain
362730
+     * socket, if the server's backlog is full.  Unfortunately there
362730
+     * is nothing good we can do on the client side when this happens
362730
+     * since any solution would involve sleeping or busy-waiting.  The
362730
+     * only solution is on the server side, increasing the backlog.
362730
+     * But at least improve the error message.
362730
+     * https://bugzilla.redhat.com/1925045
362730
+     */
362730
+    SET_NEXT_STATE (%.DEAD);
362730
+    set_error (errno, "connect: server backlog overflowed, "
362730
+               "see https://bugzilla.redhat.com/1925045");
362730
+    return 0;
362730
+  }
362730
+#endif
362730
   SET_NEXT_STATE (%.DEAD);
362730
   set_error (errno, "connect");
362730
   return 0;
362730
-- 
6aa05d
2.31.1
362730