- if (next) {
- if (uatomic_cmpxchg(&q->head, head, next) == head) {
- if (is_dummy(q, head)) {
- struct cds_lfq_node_rcu *node;
- /*
- * Requeue dummy. We need to
- * reallocate to protect from
- * ABA.
- */
- rcu_free_dummy(head);
- node = make_dummy(q, NULL);
- /*
- * We are the only thread
- * allowed to update dummy (we
- * own the old dummy).
- */
- q->dummy = node;
- _cds_lfq_enqueue_rcu(q, node);
- continue; /* try again */
- }
- return head;
- } else {
- /* Concurrently pushed, retry */
- continue;
- }
- } else {
- /* Dummy node re-enqueue is in progress, retry. */
- continue;
+ if (!next) {
+ enqueue_dummy(q);
+ next = rcu_dereference(head->next);
+ }
+ if (uatomic_cmpxchg(&q->head, head, next) != head)
+ continue; /* Concurrently pushed. */
+ if (head->dummy) {
+ /* Free dummy after grace period. */
+ rcu_free_dummy(head);
+ continue; /* try again */