[4.1] 44bf9f3cd clarify that we handle references correctly

Nils Goroll nils.goroll at uplex.de
Wed Sep 26 07:26:10 UTC 2018


commit 44bf9f3cde555c6548c6f2efeb4ce5433995cb70
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed Sep 26 09:14:20 2018 +0200

    clarify that we handle references correctly
    
    This is no semantic change, but rather than indirectly checking
    via the retval, we might also check the reason for keeping a
    reference (or rather, not).

diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index d1f5f1c56..4d4e67afe 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -495,7 +495,7 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
 		if (exp_oc->hits < LONG_MAX)
 			exp_oc->hits++;
 		Lck_Unlock(&oh->mtx);
-		if (retval == HSH_EXP)
+		if (*bocp == NULL)
 			assert(HSH_DerefObjHead(wrk, &oh));
 		*ocp = exp_oc;
 		return (retval);


More information about the varnish-commit mailing list