[master] ae63cc5 We cannot assume that nobody else have killed the object we are trying to snipe. If they did, fail the sniping.

Poul-Henning Kamp phk at FreeBSD.org
Mon May 9 08:55:06 CEST 2016


commit ae63cc53e77138f27af4f1a519c23161e8c29c75
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon May 9 06:53:09 2016 +0000

    We cannot assume that nobody else have killed the object we are
    trying to snipe.  If they did, fail the sniping.
    
    Fixes #1942

diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index 6df5160..cc4e96f 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -724,10 +724,8 @@ HSH_Snipe(const struct worker *wrk, struct objcore *oc)
 	CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
 	CHECK_OBJ_NOTNULL(oc->objhead, OBJHEAD_MAGIC);
 
-	AZ(oc->flags & OC_F_DYING);
-
 	if (oc->refcnt == 1 && !Lck_Trylock(&oc->objhead->mtx)) {
-		if (oc->refcnt == 1) {
+		if (oc->refcnt == 1 && !(oc->flags & OC_F_DYING)) {
 			oc->flags |= OC_F_DYING;
 			oc->refcnt++;
 			retval = 1;



More information about the varnish-commit mailing list