From ef9f52b780558d66022fcebc5ceae884052f8932 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Fri, 5 Mar 2021 11:16:04 -0500 Subject: [PATCH] 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 --- lib/maple_tree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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; -- 2.50.1