Fix rcuja: fallback when adding element to full pool
[userspace-rcu.git] / rcuja / rcuja.c
index d24aaad1a87c0727afdfea0382fca951a5f2a520..fac1eb75d56a09210e87296a35b14664a09724ec 100644 (file)
@@ -835,6 +835,9 @@ skip_copy:
                ret = _ja_node_set_nth(new_type, new_node,
                                new_shadow_node,
                                n, child_node_flag);
+               if (new_type->type_class == RCU_JA_POOL && ret) {
+                       goto fallback_toosmall;
+               }
                assert(!ret);
        }
        /* Return pointer to new recompacted node through old_node_flag_ptr */
@@ -1419,6 +1422,10 @@ int ja_unchain_node(struct cds_ja *ja,
         * list (while holding lock).
         */
        cds_hlist_for_each_rcu(hlist_node, &hlist_head) {
+               if (count == 0) {
+                       /* FIXME: currently a work-around */
+                       hlist_node->prev = (struct cds_hlist_node *) node_flag_ptr;
+               }
                count++;
                if (hlist_node == &node->list)
                        found++;
@@ -1429,6 +1436,10 @@ int ja_unchain_node(struct cds_ja *ja,
                goto end;
        }
        cds_hlist_del_rcu(&node->list);
+       /*
+        * Validate that we indeed removed the node from linked list.
+        */
+       assert(ja_node_ptr(*node_flag_ptr) != (struct cds_ja_inode *) node);
 end:
        rcuja_shadow_unlock(shadow_node);
        return ret;
This page took 0.023681 seconds and 4 git commands to generate.