[master] 176190e Also retire the waitinglist structure if the number of sessions on it happened to be a multiplum of rush_exponent.

Poul-Henning Kamp phk at varnish-cache.org
Thu Jan 27 17:09:41 CET 2011


commit 176190e67641de430bbf0ddffe31d5b49cf670d6
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Jan 27 16:08:49 2011 +0000

    Also retire the waitinglist structure if the number of sessions on
    it happened to be a multiplum of rush_exponent.
    
    Fixes:	#842

diff --git a/bin/varnishd/cache_hash.c b/bin/varnishd/cache_hash.c
index 39d416f..7266a56 100644
--- a/bin/varnishd/cache_hash.c
+++ b/bin/varnishd/cache_hash.c
@@ -485,11 +485,8 @@ hsh_rush(struct objhead *oh)
 	CHECK_OBJ_NOTNULL(wl, WAITINGLIST_MAGIC);
 	for (u = 0; u < params->rush_exponent; u++) {
 		sp = VTAILQ_FIRST(&wl->list);
-		if (sp == NULL) {
-			oh->waitinglist = NULL;
-			FREE_OBJ(wl);
-			return;
-		}
+		if (sp == NULL) 
+			break;
 		CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 		AZ(sp->wrk);
 		VTAILQ_REMOVE(&wl->list, sp, list);
@@ -503,6 +500,10 @@ hsh_rush(struct objhead *oh)
 			break;
 		}
 	}
+	if (VTAILQ_EMPTY(&wl->list)) {
+		oh->waitinglist = NULL;
+		FREE_OBJ(wl);
+	}
 }
 
 /*---------------------------------------------------------------------



More information about the varnish-commit mailing list