From: wessels <> Date: Fri, 21 Aug 1998 14:40:57 +0000 (+0000) Subject: Fixed up ugly confusion with public keys and RELEASE_REQUEST states. X-Git-Tag: SQUID_3_0_PRE1~2815 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f3e570e929c42fd0480a5ef28f17d003b5275d3a;p=thirdparty%2Fsquid.git Fixed up ugly confusion with public keys and RELEASE_REQUEST states. Some other failed assertions led me to an object with a public cache key, but which was not being swapped out because the proxy-only option made us call storeReleaseRequest early (before reading any server reply). RELEASE_REQUEST objects should never be given public keys. storeReleaseRequest now clears the ENTRY cachable bit to help ensure this doesn't happen. --- diff --git a/src/http.cc b/src/http.cc index 7ff0e2ac5f..5fb413748b 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.312 1998/08/21 03:15:17 wessels Exp $ + * $Id: http.cc,v 1.313 1998/08/21 08:40:57 wessels Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -115,8 +115,8 @@ static void httpMakePrivate(StoreEntry * entry) { storeExpireNow(entry); - EBIT_CLR(entry->flag, ENTRY_CACHABLE); storeReleaseRequest(entry); /* delete object when not used */ + /* storeReleaseRequest clears ENTRY_CACHABLE flag */ } /* This object may be negatively cached */ diff --git a/src/store.cc b/src/store.cc index f16e4d0c89..667e031e42 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.448 1998/08/21 03:15:24 wessels Exp $ + * $Id: store.cc,v 1.449 1998/08/21 08:40:59 wessels Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -232,6 +232,12 @@ storeReleaseRequest(StoreEntry * e) assert(storeEntryLocked(e)); debug(20, 3) ("storeReleaseRequest: '%s'\n", storeKeyText(e->key)); EBIT_SET(e->flag, RELEASE_REQUEST); + /* + * Clear cachable flag here because we might get called before + * anyone else even looks at the cachability flag. Also, this + * prevents httpMakePublic from really setting a public key. + */ + EBIT_CLR(entry->flag, ENTRY_CACHABLE); storeSetPrivateKey(e); } @@ -311,6 +317,14 @@ storeSetPublicKey(StoreEntry * e) if (e->key && !EBIT_TEST(e->flag, KEY_PRIVATE)) return; /* is already public */ assert(mem); + /* + * We can't make RELEASE_REQUEST objects public. Depending on + * when RELEASE_REQUEST gets set, we might not be swapping out + * the object. If we're not swapping out, then subsequent + * store clients won't be able to access object data which has + * been freed from memory. + */ + assert(!EBIT_TEST(e->flag, RELEASE_REQUEST)); newkey = storeKeyPublic(mem->url, mem->method); if ((e2 = (StoreEntry *) hash_lookup(store_table, newkey))) { debug(20, 3) ("storeSetPublicKey: Making old '%s' private.\n", mem->url);