From 1c2fb029db164456d21d679551a67a1883c01a92 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Vavru=C5=A1a?= Date: Sat, 13 Jun 2015 00:19:42 +0200 Subject: [PATCH] layer/rrcache: work around unreclaimable pages on clear --- lib/layer/rrcache.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/layer/rrcache.c b/lib/layer/rrcache.c index 1595accef..312470018 100644 --- a/lib/layer/rrcache.c +++ b/lib/layer/rrcache.c @@ -270,6 +270,14 @@ static int stash(knot_layer_t *ctx, knot_pkt_t *pkt) } /* Clear if full */ if (ret == KNOT_ESPACE) { + /* + * Commit empty transaction to make freed pages reclaimable + * (This increases the txnid) + */ + if (kr_cache_txn_begin(cache, &txn, 0) == 0) { + kr_cache_txn_commit(&txn); + } + /* Now drop the database */ if (kr_cache_txn_begin(cache, &txn, 0) == 0) { ret = kr_cache_clear(&txn); if (ret == 0) { -- 2.47.2