From 5bba33c94bf702f4b10b2d90304f5e5ce749ebbb Mon Sep 17 00:00:00 2001 From: Alex Rousskov Date: Sat, 27 Jul 2013 19:13:57 -0600 Subject: [PATCH] Removing a shared cache entry w/o slices does not count as successful purging because all callers need a new slice, not an available anchor position. --- src/ipc/StoreMap.cc | 3 ++- src/ipc/StoreMap.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ipc/StoreMap.cc b/src/ipc/StoreMap.cc index f27364ebce..2cd1e5c118 100644 --- a/src/ipc/StoreMap.cc +++ b/src/ipc/StoreMap.cc @@ -356,7 +356,8 @@ Ipc::StoreMap::purgeOne() assert(valid(fileno)); Anchor &s = shared->slots[fileno].anchor; if (s.lock.lockExclusive()) { - if (!s.empty()) { + // the caller wants a free slice; empty anchor is not enough + if (!s.empty() && s.start >= 0) { // this entry may be marked for deletion, and that is OK freeChain(fileno, s, false); debugs(54, 5, "purged entry " << fileno << " from " << path); diff --git a/src/ipc/StoreMap.h b/src/ipc/StoreMap.h index d441c858ae..97154e63a1 100644 --- a/src/ipc/StoreMap.h +++ b/src/ipc/StoreMap.h @@ -180,7 +180,7 @@ public: /// stop writing the entry, freeing its slot for others to use if possible void abortWriting(const sfileno fileno); - /// finds an unlocked entry and frees it or returns false + /// either finds and frees an entry with at least 1 slice or returns false bool purgeOne(); /// copies slice to its designated position -- 2.47.2