]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Allow non-shared memory caching when there are no cache_dirs.
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 12 Oct 2011 20:56:41 +0000 (14:56 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Wed, 12 Oct 2011 20:56:41 +0000 (14:56 -0600)
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.

src/store_dir.cc

index 84223a1b117e9a009b8e54f84972a41ab46defcb..92ba9a1dddcca48624707d4a4438123a90d8c896 100644 (file)
@@ -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) {