call_rcu threads should clear their PAUSED flag when they unpause
authorKeir Fraser <keir@cohodata.com>
Mon, 7 Apr 2014 13:28:52 +0000 (14:28 +0100)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 17 Apr 2014 13:08:45 +0000 (09:08 -0400)
And call_rcu_after_fork_parent should spin-wait on this.

Otherwise a second fork in the parent will see the PAUSED flags
already set and call_rcu_before_fork will not correctly wait for the
call_rcu threads to quiesce on this second occasion.

Fixes #786

Signed-off-by: Keir Fraser <keir@cohodata.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu-call-rcu-impl.h

index 04f7798c3f57a433a3756f267e0ffdc07e5e4552..c0298d24b6a732ba7979fa3aa740b4085e1ccb45 100644 (file)
@@ -267,6 +267,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();
                }
 
@@ -763,6 +765,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.025724 seconds and 4 git commands to generate.