]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Removing a shared cache entry w/o slices does not count as successful purging
authorAlex Rousskov <rousskov@measurement-factory.com>
Sun, 28 Jul 2013 01:13:57 +0000 (19:13 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Sun, 28 Jul 2013 01:13:57 +0000 (19:13 -0600)
because all callers need a new slice, not an available anchor position.

src/ipc/StoreMap.cc
src/ipc/StoreMap.h

index f27364ebce48a9c717a0424ff07c3ac77b051947..2cd1e5c1182d80be962378ccbc293c805104bf61 100644 (file)
@@ -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);
index d441c858ae4493d87f05517de569598d2860d821..97154e63a11b7f959a21c133000b1bd75fb114c5 100644 (file)
@@ -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