summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2012-01-08 20:23:46 -0800
committerdormando <dormando@rydia.net>2012-01-08 20:23:46 -0800
commit324975cee252e7d28496a238334c22eba6d7cda1 (patch)
treed475a9c9a41a459faddb6dadfe2ae8b5e1daec3b
parent193a653e9678080f5ef7841ce93dca8e24116949 (diff)
downloadmemcached-324975cee252e7d28496a238334c22eba6d7cda1.tar.gz
fix braindead linked list fail
I re-implemented a linked list for the slab freelist since we don't need to manage the tail, check the previous item, and use it as a FIFO. However prev/next must be managed so the slab mover is safe. However I neglected to clear prev on a fetch, so if the slab mover was zeroing the head of the freelist it would relink the next item in the freelist with one in the main LRU. Which results in chaos.
-rw-r--r--slabs.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/slabs.c b/slabs.c
index c56b678..6029c34 100644
--- a/slabs.c
+++ b/slabs.c
@@ -249,6 +249,7 @@ static void *do_slabs_alloc(const size_t size, unsigned int id) {
/* return off our freelist */
it = (item *)p->slots;
p->slots = it->next;
+ if (it->next) it->next->prev = 0;
p->sl_curr--;
ret = (void *)it;
} else {