]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
layer/rrcache: work around unreclaimable pages on clear
authorMarek Vavruša <marek.vavrusa@nic.cz>
Fri, 12 Jun 2015 22:19:42 +0000 (00:19 +0200)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Fri, 12 Jun 2015 22:19:42 +0000 (00:19 +0200)
lib/layer/rrcache.c

index 1595accefd6a0072f5d3d9390bdb07f7c4876e57..31247001874f45ddbc89ccbf142981275d2aa9f6 100644 (file)
@@ -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) {