From 66dd35b9a54301d63860d45729680e846fbbef07 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 1 May 2017 14:30:20 -0700 Subject: [PATCH] scoutfs: fix ring next/prev The ring node rb walker was returning an exact match for the search key instead of the last node that was traversed. This stopped callers from then iterating from the traversed node to find the next or previous node. Signed-off-by: Zach Brown --- kmod/src/ring.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kmod/src/ring.c b/kmod/src/ring.c index 6df1c04c..7eb61b0a 100644 --- a/kmod/src/ring.c +++ b/kmod/src/ring.c @@ -178,7 +178,7 @@ static struct ring_node *ring_rb_walk(struct scoutfs_ring_info *ring, struct rb_node **node = &ring->rb_root.rb_node; struct rb_node *parent = NULL; struct ring_node *found = NULL; - struct ring_node *rnode; + struct ring_node *rnode = NULL; /* only provide one or the other */ BUG_ON(!!key == !!data); @@ -213,9 +213,10 @@ static struct ring_node *ring_rb_walk(struct scoutfs_ring_info *ring, rb_insert_color(&ins->rb_node, &ring->rb_root); } found = ins; + *cmp = 0; } - return found; + return rnode; } static struct ring_node *ring_rb_entry(struct rb_node *node)