Skip to content

maple_tree: Fix the replacement of a root leaf node

Wei Yang linux-mm stable 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 4 repliesIn review
  2. v2 posting 2/23 patches 2 repliesSuperseded
  3. v2 posting 1/23 patches 0 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3maple_tree: Fix mt_destroy_walk() on root leaf nodelib/maple_tree.c+1 -00 replies
2/3maple_tree: restart walk on correct statuslib/maple_tree.c+1 -10 replies
3/3maple_tree: assert retrieving new value on a tree containing just a leaf nodetools/testing/radix-tree/maple.c+24 -00 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchLiam R. Howlett
1/3R-b
2/3R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [Patch v3 0/3] maple_tree: Fix the replacement of a root leaf node

On destroy we should set each node dead. But current code miss this when the maple tree has only the root node.

The reason is mt_destroy_walk() leverage mte_destroy_descend() to set node dead, but this is skipped since the only root node is a leaf.

Patch 1 fixes this.

When adding a test case, I found we always get the new value even we leave the old root node not dead. It turns out we always re-walk the tree in mas_walk(). It looks like a typo on the status check of mas_walk().

Patch 2 fixes this.

Patch 3 add a test case to assert retrieving new value when overwriting the whole range to a tree with only root node.

V3 rebase on latest mm-unstable with base commit eba4438e2296.

Wei Yang (3):
maple_tree: Fix mt_destroy_walk() on root leaf node
maple_tree: restart walk on correct status
maple_tree: assert retrieving new value on a tree containing just a
leaf node

 lib/maple_tree.c                 |  3 ++-
 tools/testing/radix-tree/maple.c | 24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)
Signature · 1 line
2.34.1