From 8ea414ac687b460c2fb824113d1d1e2d47c3ec22 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 16 May 2017 14:51:36 -0700 Subject: [PATCH] scoutfs: clear seg rb node after replacing When inserting a newly allocated segment we might find an existing cached stale segment. We replace it in the cache so that its user can keep using its stale contents while we work on the new segment. Replacing doesn't clear the rb_node, though, so we trip over a warning when we finally free the segment and it looks like it's still present in the rb tree. Clear the node after we replace it so that freeing sees a clear node and doesn't issue a warning. Signed-off-by: Zach Brown --- kmod/src/seg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kmod/src/seg.c b/kmod/src/seg.c index 6e0fc04a..767bab2e 100644 --- a/kmod/src/seg.c +++ b/kmod/src/seg.c @@ -182,6 +182,7 @@ static struct scoutfs_segment *replace_seg(struct segment_cache *cac, node = &(*node)->rb_right; } else { rb_replace_node(&seg->node, &ins->node, root); + RB_CLEAR_NODE(&seg->node); lru_check(cac, seg); lru_check(cac, ins); found = seg;