From: Alex Rousskov Date: Wed, 12 Oct 2011 20:56:41 +0000 (-0600) Subject: Allow non-shared memory caching when there are no cache_dirs. X-Git-Tag: BumpSslServerFirst.take01~104 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=897d56561e6e6484f6ebe968fb012521b784bfd6;p=thirdparty%2Fsquid.git Allow non-shared memory caching when there are no cache_dirs. Before this change, we destroyed unused/idle StoreEntries if nobody was voting to keep them in store_table. That blocked non-shared memory cache from getting new entries if there were no cache_dirs to vote for them, which is wrong. The new code keeps unused/idle StoreEntries in store_table if nobody objects. --- diff --git a/src/store_dir.cc b/src/store_dir.cc index 84223a1b11..92ba9a1ddd 100644 --- a/src/store_dir.cc +++ b/src/store_dir.cc @@ -684,16 +684,16 @@ StoreController::reference(StoreEntry &e) bool StoreController::dereference(StoreEntry & e) { - bool keepInStoreTable = false; + bool keepInStoreTable = true; // keep if there are no objections /* Notify the fs that we're not referencing this object any more */ if (e.swap_filen > -1) - keepInStoreTable = swapDir->dereference(e) || keepInStoreTable; + keepInStoreTable = swapDir->dereference(e) && keepInStoreTable; // Notify the memory cache that we're not referencing this object any more if (memStore && e.mem_status == IN_MEMORY) - keepInStoreTable = memStore->dereference(e) || keepInStoreTable; + keepInStoreTable = memStore->dereference(e) && keepInStoreTable; // TODO: move this code to a non-shared memory cache class when we have it if (e.mem_obj) {