Fix: add missing rcu_barrier before daemon teardown
[lttng-tools.git] / src / bin / lttng-consumerd / lttng-consumerd.c
index 1636b9c0d22777798ff220df010c4bc5ca6c9634..7f78c4ec2b0971fcfa249a3c35f7c953bd5a8d39 100644 (file)
@@ -99,14 +99,6 @@ static void sighandler(int sig)
                return;
        }
 
-       /*
-        * Ignore SIGPIPE because it should not stop the consumer whenever a
-        * SIGPIPE is caught through a FD operation.
-        */
-       if (sig == SIGPIPE) {
-               return;
-       }
-
        if (ctx) {
                lttng_consumer_should_exit(ctx);
        }
@@ -127,9 +119,10 @@ static int set_signal_handler(void)
                return ret;
        }
 
-       sa.sa_handler = sighandler;
        sa.sa_mask = sigset;
        sa.sa_flags = 0;
+
+       sa.sa_handler = sighandler;
        if ((ret = sigaction(SIGTERM, &sa, NULL)) < 0) {
                PERROR("sigaction");
                return ret;
@@ -140,6 +133,7 @@ static int set_signal_handler(void)
                return ret;
        }
 
+       sa.sa_handler = SIG_IGN;
        if ((ret = sigaction(SIGPIPE, &sa, NULL)) < 0) {
                PERROR("sigaction");
                return ret;
@@ -628,6 +622,12 @@ exit_init_data:
        tmp_ctx = ctx;
        ctx = NULL;
        cmm_barrier();  /* Clear ctx for signal handler. */
+       /*
+        * Wait for all pending call_rcu work to complete before tearing
+        * down data structures. call_rcu worker may be trying to
+        * perform lookups in those structures.
+        */
+       rcu_barrier();
        lttng_consumer_destroy(tmp_ctx);
        lttng_consumer_cleanup();
 
This page took 0.024566 seconds and 4 git commands to generate.