From: Alex Rousskov Date: Sat, 27 Jul 2013 17:29:25 +0000 (-0600) Subject: Prevent premature swapout aborts when the last local entry reader goes away. X-Git-Tag: SQUID_3_5_0_1~444^2~26 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=22bbd8400515746f288f80924b9e6508527ff76b;p=thirdparty%2Fsquid.git Prevent premature swapout aborts when the last local entry reader goes away. --- diff --git a/src/store_client.cc b/src/store_client.cc index f670286431..8007f78700 100644 --- a/src/store_client.cc +++ b/src/store_client.cc @@ -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;