From 22696a1676f7009ba44984129364c545e264702d Mon Sep 17 00:00:00 2001 From: Alex Rousskov Date: Mon, 1 Jul 2013 13:59:32 -0600 Subject: [PATCH] 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(). --- src/store.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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; } -- 2.47.2