commit c36131d: [Fix] Fix eviction corner case

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Jul 22 15:14:03 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-07-22 16:10:20 +0100
URL: https://github.com/rspamd/rspamd/commit/c36131d2bd53707f71ad9c63875db5d506f3b45f (HEAD -> master)

[Fix] Fix eviction corner case
Issue: #2991

---
 src/libutil/hash.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/libutil/hash.c b/src/libutil/hash.c
index 56e80a17e..09d3a29c1 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);
 	}


More information about the Commits mailing list