From: Liam R. Howlett Date: Fri, 5 Mar 2021 16:16:04 +0000 (-0500) Subject: maple_tree: Fix offset in mas_node_stre, find old node in mas_store_gfp. X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=ef9f52b780558d66022fcebc5ceae884052f8932;p=users%2Fjedix%2Flinux-maple.git maple_tree: Fix offset in mas_node_stre, find old node in mas_store_gfp. Needs fixing, should restore the maple state during the operation by saving the leaf info Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 78d0fec8669a..62c8c90f6af2 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -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;