[master] 4217acf99 Polish assertion in ObjExtend()

Nils Goroll nils.goroll at uplex.de
Fri Aug 23 09:54:06 UTC 2024


commit 4217acf9976c8002ba206f389b8c715785a164f0
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Fri Aug 23 11:48:32 2024 +0200

    Polish assertion in ObjExtend()
    
    We require a busy objcore (boc) to be held for the duration of the function
    call, so it makes no sense to suddenly also accept a null boc.
    
    This looks like a minor oversight when trimstore was made a part of ObjExtend()
    in 115742b07c8bad6d465f1c981ee264f934a4492b, because previously trimstore was
    an independent Object API function which was originally intended to also be
    called on unbusy objects.

diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c
index 1f4ca9876..bdf78c162 100644
--- a/bin/varnishd/cache/cache_obj.c
+++ b/bin/varnishd/cache/cache_obj.c
@@ -256,7 +256,7 @@ ObjExtend(struct worker *wrk, struct objcore *oc, ssize_t l, int final)
 	}
 	Lck_Unlock(&oc->boc->mtx);
 
-	assert(oc->boc == NULL || oc->boc->state < BOS_FINISHED);
+	assert(oc->boc->state < BOS_FINISHED);
 	if (final && om->objtrimstore != NULL)
 		om->objtrimstore(wrk, oc);
 }


More information about the varnish-commit mailing list