Fix: rcu_barrier(): uninitialized futex field
[urcu.git] / urcu-call-rcu-impl.h
index 10c4f3ec2fad83c61e8275059fc3ce7b618d4e5b..f0751f538b4b66c829d4d988b0d5102192ad889b 100644 (file)
@@ -308,6 +308,8 @@ static void *call_rcu_thread(void *arg)
                        uatomic_or(&crdp->flags, URCU_CALL_RCU_PAUSED);
                        while ((uatomic_read(&crdp->flags) & URCU_CALL_RCU_PAUSE) != 0)
                                poll(NULL, 0, 1);
+                       uatomic_and(&crdp->flags, ~URCU_CALL_RCU_PAUSED);
+                       cmm_smp_mb__after_uatomic_and();
                        rcu_register_thread();
                }
 
@@ -812,6 +814,7 @@ void rcu_barrier(void)
                count++;
 
        completion.barrier_count = count;
+       completion.futex = 0;
 
        cds_list_for_each_entry(crdp, &call_rcu_data_list, list) {
                struct call_rcu_completion_work *work;
@@ -872,6 +875,10 @@ void call_rcu_after_fork_parent(void)
 
        cds_list_for_each_entry(crdp, &call_rcu_data_list, list)
                uatomic_and(&crdp->flags, ~URCU_CALL_RCU_PAUSE);
+       cds_list_for_each_entry(crdp, &call_rcu_data_list, list) {
+               while ((uatomic_read(&crdp->flags) & URCU_CALL_RCU_PAUSED) != 0)
+                       poll(NULL, 0, 1);
+       }
        call_rcu_unlock(&call_rcu_mutex);
 }
 
This page took 0.024488 seconds and 4 git commands to generate.