]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Fix offset in mas_node_stre, find old node in mas_store_gfp.
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 5 Mar 2021 16:16:04 +0000 (11:16 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 5 Mar 2021 16:16:04 +0000 (11:16 -0500)
Needs fixing, should restore the maple state during the operation by saving the leaf info

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
lib/maple_tree.c

index 78d0fec8669a0c37dc5e2279d5fd496c0e197575..62c8c90f6af24d6d78d4f3a1dde46cbc3e1fac09 100644 (file)
@@ -3667,6 +3667,7 @@ static inline bool mas_node_store(struct ma_state *mas, void *entry,
        // Store the new entry and range end.
        if (dst_offset < max_piv)
                dst_pivots[dst_offset] = mas->last;
+       mas->offset = dst_offset;
        rcu_assign_pointer(dst_slots[dst_offset++], entry);
 
        if (offset_end > end) // this range wrote to the end of the node.
@@ -5191,7 +5192,7 @@ void *mas_store(struct ma_state *mas, void *entry)
                return existing;
 
        if (unlikely(!mte_is_leaf(mas->node))) // spanning store occurred
-               mas->node = MAS_START;
+               mas_walk(mas);
 
        return existing;
 }
@@ -5221,7 +5222,7 @@ retry:
                return xa_err(mas->node);
 
        if (unlikely(!mte_is_leaf(mas->node))) // spanning store occurred
-               mas->node = MAS_START;
+               mas_walk(mas);
 
        return 0;