]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Prevent premature swapout aborts when the last local entry reader goes away.
authorAlex Rousskov <rousskov@measurement-factory.com>
Sat, 27 Jul 2013 17:29:25 +0000 (11:29 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Sat, 27 Jul 2013 17:29:25 +0000 (11:29 -0600)
src/store_client.cc

index f670286431b719fdd4daa42917a4e7ef35622f71..8007f78700670e2c1438261f01254439b84a9d38 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "squid.h"
 #include "event.h"
+#include "globals.h"
 #include "HttpReply.h"
 #include "HttpRequest.h"
 #include "MemBuf.h"
@@ -770,8 +771,7 @@ StoreEntry::invokeHandlers()
     PROF_stop(InvokeHandlers);
 }
 
-// XXX: Does not account for remote readers of local writers, causing
-// premature StoreEntry aborts.
+// Does not account for remote readers/clients.
 int
 storePendingNClients(const StoreEntry * e)
 {
@@ -849,6 +849,8 @@ CheckQuickAbortIsReasonable(StoreEntry * entry)
     return true;
 }
 
+/// Aborts a swapping-out entry if nobody needs it any more _and_
+/// continuing swap out is not reasonable per CheckQuickAbortIsReasonable().
 static void
 CheckQuickAbort(StoreEntry * entry)
 {
@@ -857,6 +859,9 @@ CheckQuickAbort(StoreEntry * entry)
     if (storePendingNClients(entry) > 0)
         return;
 
+    if (!shutting_down && Store::Root().transientReaders(*entry))
+        return;
+
     if (entry->store_status != STORE_PENDING)
         return;