From: Marek VavruĊĦa Date: Fri, 12 Jun 2015 22:19:42 +0000 (+0200) Subject: layer/rrcache: work around unreclaimable pages on clear X-Git-Tag: v1.0.0-beta1~120^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c2fb029db164456d21d679551a67a1883c01a92;p=thirdparty%2Fknot-resolver.git layer/rrcache: work around unreclaimable pages on clear --- 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) {