[master] 8e8e7896b hash: Apply OC_F_DYING to purged objects

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Mar 18 16:13:00 UTC 2024


commit 8e8e7896b24cedb834a7e37f71f531c702f26c84
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Tue Mar 12 17:39:43 2024 +0100

    hash: Apply OC_F_DYING to purged objects
    
    All paths to EXP_Remove() raise the OC_F_DYING flag to dismiss the
    objcore in HSH_Lookup(). A regular purge used to EXP_Rearm() an oc
    for immediate (yet delayed) expiry, leaving it to the expiry thread
    to apply this flag and call EXP_Remove().
    
    When the regular purge went from EXP_Rearm() to EXP_Remove() in order
    to avoid counting purged objects as expired, the OC_F_DYING flag was
    overlooked.
    
    Refs 709f71ab731298fa4d30d4c8b2b61dae04002ea6

diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index ce31aecf0..8627c7a95 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -718,6 +718,8 @@ HSH_Purge(struct worker *wrk, struct objhead *oh, vtim_real ttl_now,
 			}
 			if (oc->flags & OC_F_DYING)
 				continue;
+			if (is_purge)
+				oc->flags |= OC_F_DYING;
 			oc->refcnt++;
 			ocp[n++] = oc;
 		}


More information about the varnish-commit mailing list