workqueue: ensure worker is removed from waitqueue upon unregister
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 23 Oct 2014 15:27:58 +0000 (11:27 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 23 Oct 2014 15:27:58 +0000 (11:27 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu/workqueue-fifo.h

index 6256bff8218c87673fdfa865b39c4ec87ae6da83..1292e04d6a173f6a276d6fab70dfaca004f7f26d 100644 (file)
@@ -159,13 +159,10 @@ void urcu_worker_unregister(struct urcu_workqueue *queue,
        }
 
        /*
-        * Wait for grace period before freeing or reusing
-        * "worker" because used by RCU linked list.
-        * Also prevents ABA for waitqueue stack dequeue: matches RCU
-        * read-side critical sections around dequeue and move all
-        * operations on waitqueue).
+        * Make sure we are removed from waitqueue.
         */
-       synchronize_rcu();
+       if (CMM_LOAD_SHARED(worker->wait_node.node.next))
+               __urcu_workqueue_wakeup_all(queue);
 
        /*
         * Put any local work we still have back into the workqueue.
@@ -184,6 +181,15 @@ void urcu_worker_unregister(struct urcu_workqueue *queue,
                (void) urcu_dequeue_wake_single(&queue->waitqueue);
                rcu_read_unlock();      /* Protect stack dequeue */
        }
+
+       /*
+        * Wait for grace period before freeing or reusing
+        * "worker" because used by RCU linked list.
+        * Also prevents ABA for waitqueue stack dequeue: matches RCU
+        * read-side critical sections around dequeue and move all
+        * operations on waitqueue).
+        */
+       synchronize_rcu();
 }
 
 /*
This page took 0.026404 seconds and 4 git commands to generate.