[3.0] ef93091 Do not try to expire objects that are still busy.

Martin Blix Grydeland martin at varnish-cache.org
Thu Jul 19 10:41:28 CEST 2012


commit ef930917740c3f2b81d8c08219d99dcc7bd3dc60
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Wed Jul 4 13:07:15 2012 +0200

    Do not try to expire objects that are still busy.
    
    There is a short window of opportunity between HSH_Insert() and
    HSH_Unbusy(), where the locks are released and the expiry thread can
    try to expire an object that is still busy (for objects with very
    short TTL). This patch makes the expiry thread check for busy objects
    and wait if the head of the binheap is busy.
    
    No test case as the window is too small.
    
    Fixes: #1150

diff --git a/bin/varnishd/cache_expire.c b/bin/varnishd/cache_expire.c
index 15482bf..5dbafa6 100644
--- a/bin/varnishd/cache_expire.c
+++ b/bin/varnishd/cache_expire.c
@@ -371,6 +371,13 @@ exp_timer(struct sess *sp, void *priv)
 			continue;
 		}
 
+		/* If the object is busy, we have to wait for it */
+		if (oc->flags & OC_F_BUSY) {
+			Lck_Unlock(&exp_mtx);
+			oc = NULL;
+			continue;
+		}
+
 		/*
 		 * It's time...
 		 * Technically we should drop the exp_mtx, get the lru->mtx



More information about the varnish-commit mailing list