summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/maple_tree.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 3f794ef072f4..5610b3742a79 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -2893,11 +2893,21 @@ static void mas_spanning_rebalance(struct ma_state *mas,
mast_combine_cp_right(mast);
mast->orig_l->last = mast->orig_l->max;
- if (mast_sufficient(mast))
- continue;
+ if (mast_sufficient(mast)) {
+ if (mast_overflow(mast))
+ continue;
+
+ if (mast->orig_l->node == mast->orig_r->node) {
+ /*
+ * The data in b_node should be stored in one
+ * node and in the tree
+ */
+ slot = mast->l->offset;
+ break;
+ }
- if (mast_overflow(mast))
continue;
+ }
/* May be a new root stored in mast->bn */
if (mas_is_root_limits(mast->orig_l))