Fix: add missing rcu_barrier before daemon teardown
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 21 Dec 2016 22:59:38 +0000 (17:59 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 9 Jan 2017 17:34:34 +0000 (12:34 -0500)
When performing the "cleanup" of sessiond, consumerd, and relayd, we
destroy data structures that may still be concurrently accessed by
call_rcu worker thread.

Ensure no more work is present in the call_rcu worker thread by issuing
a rcu_barrier barrier. Note that this expects call_rcu handlers don't
chain work to other call_rcu handlers.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-consumerd/lttng-consumerd.c
src/bin/lttng-relayd/main.c
src/bin/lttng-sessiond/main.c

index 079bd60240ef2ac864a51e05c755423c78b9ddf0..293654053e87ad046d4cc2716de75e1934b513f8 100644 (file)
@@ -628,6 +628,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();
 
index 2714f783bcc97768063ff3f01605f1c9dc55688f..56efaae3409748ba6134d72de26692aae6689649 100644 (file)
@@ -2944,6 +2944,12 @@ exit_init_data:
        health_app_destroy(health_relayd);
 exit_health_app_create:
 exit_options:
+       /*
+        * 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();
        relayd_cleanup();
 
        /* Ensure all prior call_rcu are done. */
index e810d5614996925faae66ed1946fa8c1c2012827..b29c6745bd51e8ea0cd1c0d9648f0ab8c3fe4198 100644 (file)
@@ -6221,6 +6221,12 @@ exit_client:
 exit_health:
 
 exit_init_data:
+       /*
+        * 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();
        /*
         * sessiond_cleanup() is called when no other thread is running, except
         * the ht_cleanup thread, which is needed to destroy the hash tables.
This page took 0.029114 seconds and 4 git commands to generate.