[master] 52a6d38c5 sml: fix glitch in "Optimize freebehind (transient) memory usage"

Nils Goroll nils.goroll at uplex.de
Thu Oct 24 11:02:06 UTC 2024


commit 52a6d38c5709cf1a92896d5dc2e984962ce10446
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Oct 24 12:54:51 2024 +0200

    sml: fix glitch in "Optimize freebehind (transient) memory usage"
    
    Ref 5c2a682aa39af1c61e860f3a62a204d200ac3211
    
    If the checkpoint segment is the stevedore_priv, it has already been removed
    from the segment list, see sml_trimstore()

diff --git a/bin/varnishd/storage/storage_simple.c b/bin/varnishd/storage/storage_simple.c
index 53eb305de..1dea4dc39 100644
--- a/bin/varnishd/storage/storage_simple.c
+++ b/bin/varnishd/storage/storage_simple.c
@@ -396,9 +396,10 @@ sml_iterator(struct worker *wrk, struct objcore *oc,
 			sl += st->len;
 			st = VTAILQ_PREV(st, storagehead, list);
 			if (final && checkpoint != NULL) {
-				VTAILQ_REMOVE(&obj->list, checkpoint, list);
 				if (checkpoint == boc->stevedore_priv)
 					boc->stevedore_priv = trim_once;
+				else
+					VTAILQ_REMOVE(&obj->list, checkpoint, list);
 				sml_stv_free(stv, checkpoint);
 			}
 			checkpoint = st;


More information about the varnish-commit mailing list