From: Alex Rousskov Date: Wed, 3 May 2023 22:20:27 +0000 (+0000) Subject: Do not check store_status when checking ENTRY_BAD_LENGTH (#1342) X-Git-Tag: SQUID_7_0_1~445 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=665f2f8534f98ea979ed1190e79612f3cb5dc15a;p=thirdparty%2Fsquid.git Do not check store_status when checking ENTRY_BAD_LENGTH (#1342) Before 1997 commit b34ed72 (that introduced the current ENTRY_BAD_LENGTH "cache"), checking store_status before calling storeEntryValidLength() kind of made sense because storeEntryValidLength() did not support STORE_PENDING entries with their unset object_len. Since that commit, checking store_status does not cause any visible problems (i.e. the code "works") because ENTRY_BAD_LENGTH implies STORE_OK. However, that implication is not backed by some fundamental invariant and might suddenly disappear. Checking two flags instead of one is also wasteful. No Squid functionality changes are expected. --- diff --git a/src/store.cc b/src/store.cc index 2df3a72eba..00d7aed1d1 100644 --- a/src/store.cc +++ b/src/store.cc @@ -915,7 +915,7 @@ StoreEntry::checkCachable() return 0; // avoid rerequesting release below } - if (store_status == STORE_OK && EBIT_TEST(flags, ENTRY_BAD_LENGTH)) { + if (EBIT_TEST(flags, ENTRY_BAD_LENGTH)) { debugs(20, 2, "StoreEntry::checkCachable: NO: wrong content-length"); ++store_check_cachable_hist.no.wrong_content_length; } else if (!mem_obj) { diff --git a/src/store_digest.cc b/src/store_digest.cc index 6b1b77a321..a965bc82ab 100644 --- a/src/store_digest.cc +++ b/src/store_digest.cc @@ -248,7 +248,7 @@ storeDigestAddable(const StoreEntry * e) return 0; } - if (e->store_status == STORE_OK && EBIT_TEST(e->flags, ENTRY_BAD_LENGTH)) { + if (EBIT_TEST(e->flags, ENTRY_BAD_LENGTH)) { debugs(71, 6, "storeDigestAddable: NO: wrong content-length"); return 0; }