From: Vsevolod Stakhov Date: Mon, 22 Jul 2019 15:10:20 +0000 (+0100) Subject: [Fix] Fix eviction corner case X-Git-Tag: 2.0~512 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c36131d2bd53707f71ad9c63875db5d506f3b45f;p=thirdparty%2Frspamd.git [Fix] Fix eviction corner case Issue: #2991 --- diff --git a/src/libutil/hash.c b/src/libutil/hash.c index 56e80a17e2..09d3a29c14 100644 --- a/src/libutil/hash.c +++ b/src/libutil/hash.c @@ -481,6 +481,10 @@ rspamd_lru_hash_evict (rspamd_lru_hash_t *hash, time_t now) } } }); + + if (selected) { + elt = selected; + } } else { /* Fast random eviction */ @@ -493,6 +497,7 @@ rspamd_lru_hash_evict (rspamd_lru_hash_t *hash, time_t now) } } + /* Evict if nothing else has been cleaned */ if (elt && nexpired == 0) { rspamd_lru_hash_remove_node (hash, elt); }