Re: [PATCH] rbtree: stop iteration early in rb_find_first

From: Peter Zijlstra
Date: Wed Aug 25 2021 - 09:23:29 EST


On Wed, Aug 25, 2021 at 04:58:59AM -0700, Michel Lespinasse wrote:
> > NAK. This looked slightly wrong before, and is more wrong after.

> Actually, my explanation is wrong too :) but so is the code.
> A failing example would searching 10 in the following tree
>
>
> 10
> /
> 5
> \
> 10
>
> The search would stop after visiting node 5, and miss the leaf which
> is the expected node to be returned.

Just to clarify; the current code *does* work here. The proposed patch
breaks it.