r355 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Thu Jul 6 22:27:00 CEST 2006


Author: phk
Date: 2006-07-06 22:26:59 +0200 (Thu, 06 Jul 2006)
New Revision: 355

Modified:
   trunk/varnish-cache/bin/varnishd/cache_expire.c
Log:
The grim reaper needs to wait for objects refcount to drop to zero.



Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_expire.c	2006-07-06 20:23:48 UTC (rev 354)
+++ trunk/varnish-cache/bin/varnishd/cache_expire.c	2006-07-06 20:26:59 UTC (rev 355)
@@ -53,8 +53,13 @@
 	while (1) {
 		time (&t); 
 		AZ(pthread_mutex_lock(&exp_mtx));
-		o = TAILQ_FIRST(&exp_deathrow);
-		if (o == NULL || o->ttl >= t) {	/* XXX: > or >= ? */
+		TAILQ_FOREACH(o, &exp_deathrow, deathrow) {
+			if (o->ttl >= t)
+				break;
+			if (o->refcnt == 0)
+				break;
+		}
+		if (o == NULL || o->ttl >= t || o->refcnt > 0) {
 			AZ(pthread_mutex_unlock(&exp_mtx));
 			sleep(1);
 			continue;




More information about the varnish-commit mailing list