From: Alex Rousskov Date: Mon, 1 Jul 2013 19:59:32 +0000 (-0600) Subject: Do not become a store_client for entries that are not backed by Store. X-Git-Tag: SQUID_3_5_0_1~444^2~40 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=22696a1676f7009ba44984129364c545e264702d;p=thirdparty%2Fsquid.git Do not become a store_client for entries that are not backed by Store. If we ignore cache backing when becoming a store client, then StoreEntry::storeClientType() is going to make us a DISK_CLIENT by default. If there is no disk cache or it cannot be used for our entry, we will assert in store_client constructor. Prevent those assertions by checking earlier in StoreEntry::validToSend(). --- diff --git a/src/store.cc b/src/store.cc index d32f7c0ede..4e37a8f639 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1475,6 +1475,25 @@ StoreEntry::validToSend() const if (EBIT_TEST(flags, ENTRY_ABORTED)) return 0; + // now check that the entry has a cache backing or is collapsed + if (swap_filen > -1) // backed by a disk cache + return 1; + + if (swappingOut()) // will be backed by a disk cache + return 1; + + if (!mem_obj) // not backed by a memory cache and not collapsed + return 0; + + if (mem_obj->memCache.index >= 0) // backed by a shared memory cache + return 0; + + // StoreEntry::storeClientType() assumes DISK_CLIENT here, but there is no + // disk cache backing so we should not rely on the store cache at all. This + // is wrong for range requests that could feed off nibbled memory (XXX). + if (mem_obj->inmem_lo) // in local memory cache, but got nibbled at + return 0; + return 1; }