]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
lib/maple_tree: Fix mas_store_gfp() on spanning store.
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Thu, 18 Feb 2021 14:27:48 +0000 (09:27 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Thu, 18 Feb 2021 14:27:48 +0000 (09:27 -0500)
Spanning store detection needs to be more robust than checking if it spans the end of
a node.  Fix the detection by using mas_is_span_wr().  Also ensure it's not MAS_NONE.

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

index 000b49f4f1d86d43a803c5a03e215e071c753eff..329634edd8a85553c3243cdf971a98455cd56620 100644 (file)
@@ -5193,9 +5193,8 @@ void *mas_store(struct ma_state *mas, void *entry)
 int mas_store_gfp(struct ma_state *mas, void *entry, gfp_t gfp)
 {
 
-       // Detect spanning store.
-       if ((mas->last == mas->max && !entry) ||
-           (mas->last > mas->max))
+       if (mas_is_span_wr(mas, mas->max, mte_node_type(mas->node), entry) ||
+           mas_is_none(mas))
                mas->node = MAS_START;
 
 retry: