[experimental-ims] 116393f Do not try to expire objects that are still busy.

Martin Blix Grydeland martin at varnish-software.com
Thu Dec 18 10:27:51 CET 2014

commit 116393f289258b2bb9b49d518b0206cec6550a75
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/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index 8f072b6..3d18d78 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -369,6 +369,13 @@ exp_timer(struct worker *wrk, void *priv)
+		/* 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