[PATCH 2/4] lxc_controller: Move closing of handshakeFd out of virLXCControllerDaemonHandshake()

Michal Privoznik posted 4 patches 4 years, 9 months ago
[PATCH 2/4] lxc_controller: Move closing of handshakeFd out of virLXCControllerDaemonHandshake()
Posted by Michal Privoznik 4 years, 9 months ago
Future commits will want to reuse the handshakeFd and thus it
mustn't be closed in virLXCControllerDaemonHandshake(). Do the
closing explicitly afterwards.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/lxc/lxc_controller.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 50b2987d9a..797547b05c 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -353,7 +353,6 @@ static int virLXCControllerDaemonHandshake(virLXCController *ctrl)
                              _("error sending continue signal to daemon"));
         return -1;
     }
-    VIR_FORCE_CLOSE(ctrl->handshakeFd);
     return 0;
 }
 
@@ -2403,6 +2402,9 @@ virLXCControllerRun(virLXCController *ctrl)
     if (virLXCControllerDaemonHandshake(ctrl) < 0)
         goto cleanup;
 
+    /* and preemptively close handshakeFd */
+    VIR_FORCE_CLOSE(ctrl->handshakeFd);
+
     /* We must not hold open a dbus connection for life
      * of LXC instance, since dbus-daemon is limited to
      * only a few 100 connections by default
-- 
2.26.3

Re: [PATCH 2/4] lxc_controller: Move closing of handshakeFd out of virLXCControllerDaemonHandshake()
Posted by Martin Kletzander 4 years, 9 months ago
On Tue, Apr 20, 2021 at 04:15:16PM +0200, Michal Privoznik wrote:
>Future commits will want to reuse the handshakeFd and thus it
>mustn't be closed in virLXCControllerDaemonHandshake(). Do the
>closing explicitly afterwards.
>
>Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>---
> src/lxc/lxc_controller.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>

>diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
>index 50b2987d9a..797547b05c 100644
>--- a/src/lxc/lxc_controller.c
>+++ b/src/lxc/lxc_controller.c
>@@ -353,7 +353,6 @@ static int virLXCControllerDaemonHandshake(virLXCController *ctrl)
>                              _("error sending continue signal to daemon"));
>         return -1;
>     }
>-    VIR_FORCE_CLOSE(ctrl->handshakeFd);
>     return 0;
> }
>
>@@ -2403,6 +2402,9 @@ virLXCControllerRun(virLXCController *ctrl)
>     if (virLXCControllerDaemonHandshake(ctrl) < 0)
>         goto cleanup;
>
>+    /* and preemptively close handshakeFd */
>+    VIR_FORCE_CLOSE(ctrl->handshakeFd);
>+
>     /* We must not hold open a dbus connection for life
>      * of LXC instance, since dbus-daemon is limited to
>      * only a few 100 connections by default
>-- 
>2.26.3
>