linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [Patch v3 0/3] maple_tree: Fix the replacement of a root leaf node
@ 2025-06-11  1:12 Wei Yang
  2025-06-11  1:12 ` [Patch v3 1/3] maple_tree: Fix mt_destroy_walk() on " Wei Yang
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Wei Yang @ 2025-06-11  1:12 UTC (permalink / raw)
  To: Liam.Howlett, akpm, willy; +Cc: maple-tree, linux-mm, Wei Yang

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(-)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-06-11  6:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-11  1:12 [Patch v3 0/3] maple_tree: Fix the replacement of a root leaf node Wei Yang
2025-06-11  1:12 ` [Patch v3 1/3] maple_tree: Fix mt_destroy_walk() on " Wei Yang
2025-06-11  1:12 ` [Patch v3 2/3] maple_tree: restart walk on correct status Wei Yang
2025-06-11  1:12 ` [Patch v3 3/3] maple_tree: assert retrieving new value on a tree containing just a leaf node Wei Yang
2025-06-11  1:37 ` [Patch v3 0/3] maple_tree: Fix the replacement of a root " Andrew Morton
2025-06-11  2:54   ` Wei Yang
2025-06-11  3:55     ` Andrew Morton
2025-06-11  6:15       ` Wei Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).