[master] 627964a Make HSH_Deref return the busyobj to the worker for reuse when dereferencing and destroying a busy objcore.

Martin Blix Grydeland martin at varnish-cache.org
Wed Aug 3 12:36:12 CEST 2011


commit 627964a38390334a7b584a88277e36395ec5bb8b
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Tue Aug 2 23:04:14 2011 +0200

    Make HSH_Deref return the busyobj to the worker for reuse when
    dereferencing and destroying a busy objcore.
    
    Free the busyobj in the case that the worker already has one
    (potential race condition from the expiry/ban-lurker threads?)

diff --git a/bin/varnishd/cache_hash.c b/bin/varnishd/cache_hash.c
index 92ee92f..0ca8766 100644
--- a/bin/varnishd/cache_hash.c
+++ b/bin/varnishd/cache_hash.c
@@ -718,6 +718,16 @@ HSH_Deref(struct worker *w, struct objcore *oc, struct object **oo)
 	BAN_DestroyObj(oc);
 	AZ(oc->ban);
 
+	if (oc->flags & OC_F_BUSY) {
+		CHECK_OBJ_NOTNULL(oc->busyobj, BUSYOBJ_MAGIC);
+		if (w->nbusyobj == NULL)
+			w->nbusyobj = oc->busyobj;
+		else
+			FREE_OBJ(oc->busyobj);
+		oc->busyobj = NULL;
+	}
+	AZ(oc->busyobj);
+
 	if (oc->methods != NULL) {
 		oc_freeobj(oc);
 		w->stats.n_object--;



More information about the varnish-commit mailing list