[master] 6dfcc79d7 Reinstantiate "actually, the scope must not change either"

Nils Goroll nils.goroll at uplex.de
Wed Nov 13 08:48:06 UTC 2019


commit 6dfcc79d708d9013a07aab8f135003323b607bca
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Tue May 28 13:09:22 2019 +0200

    Reinstantiate "actually, the scope must not change either"
    
    This reverts commit d6d3416090b8b7db62d2cd0958e756e23ea92352 which
    reverted 86af5ce095a6e39e313cf7c6c23a49edba4aace6.
    
    The regression documented in #3003 will be solved differently in
    follow-up commits.
    
    r03003.vtc added in d6d3416090b8b7db62d2cd0958e756e23ea92352 is kept

diff --git a/bin/varnishd/cache/cache_vrt_priv.c b/bin/varnishd/cache/cache_vrt_priv.c
index d8694ccdd..33bfc4926 100644
--- a/bin/varnishd/cache/cache_vrt_priv.c
+++ b/bin/varnishd/cache/cache_vrt_priv.c
@@ -42,7 +42,6 @@ struct vrt_priv {
 #define VRT_PRIV_MAGIC			0x24157a52
 	VRBT_ENTRY(vrt_priv)		entry;
 	struct vmod_priv		priv[1];
-	uintptr_t			id;
 	uintptr_t			vmod_id;
 };
 
@@ -95,9 +94,9 @@ VRTPRIV_init(struct vrt_privs *privs)
 static inline int
 vrt_priv_dyncmp(const struct vrt_priv *vp1, const struct vrt_priv *vp2)
 {
-	if (vp1->vmod_id < vp2->vmod_id || vp1->id < vp2->id)
+	if (vp1->vmod_id < vp2->vmod_id)
 		return (-1);
-	if (vp1->vmod_id > vp2->vmod_id || vp1->id > vp2->id)
+	if (vp1->vmod_id > vp2->vmod_id)
 		return (1);
 	return (0);
 }
@@ -105,22 +104,16 @@ vrt_priv_dyncmp(const struct vrt_priv *vp1, const struct vrt_priv *vp2)
 VRBT_GENERATE_STATIC(vrt_privs, vrt_priv, entry, vrt_priv_dyncmp)
 
 static struct vmod_priv *
-vrt_priv_dynamic(struct ws *ws, struct vrt_privs *privs, uintptr_t id,
-    uintptr_t vmod_id)
+vrt_priv_dynamic(struct ws *ws, struct vrt_privs *privs, uintptr_t vmod_id)
 {
 	struct vrt_priv *vp;
-	const struct vrt_priv needle = {
-		.id = id,
-		.vmod_id = vmod_id,
-	};
+	const struct vrt_priv needle = {.vmod_id = vmod_id};
 
-	AN(id);
 	AN(vmod_id);
 
 	vp = VRBT_FIND(vrt_privs, privs, &needle);
 	if (vp) {
 		CHECK_OBJ(vp, VRT_PRIV_MAGIC);
-		assert(vp->id == id);
 		assert(vp->vmod_id == vmod_id);
 		return (vp->priv);
 	}
@@ -129,7 +122,6 @@ vrt_priv_dynamic(struct ws *ws, struct vrt_privs *privs, uintptr_t id,
 	if (vp == NULL)
 		return (NULL);
 	INIT_OBJ(vp, VRT_PRIV_MAGIC);
-	vp->id = id;
 	vp->vmod_id = vmod_id;
 	VRBT_INSERT(vrt_privs, privs, vp);
 	return (vp->priv);
@@ -148,7 +140,6 @@ VRT_priv_task(VRT_CTX, const void *vmod_id)
 		return (vrt_priv_dynamic(
 		    ctx->ws,
 		    ctx->req->privs,
-		    (uintptr_t)ctx->req,
 		    (uintptr_t)vmod_id
 		));
 	}
@@ -157,7 +148,6 @@ VRT_priv_task(VRT_CTX, const void *vmod_id)
 		return (vrt_priv_dynamic(
 		    ctx->ws,
 		    ctx->bo->privs,
-		    (uintptr_t)ctx->bo,
 		    (uintptr_t)vmod_id
 		));
 	}
@@ -166,7 +156,6 @@ VRT_priv_task(VRT_CTX, const void *vmod_id)
 	return (vrt_priv_dynamic(
 	    ctx->ws,
 	    cli_task_privs,
-	    (uintptr_t)cli_task_privs,
 	    (uintptr_t)vmod_id
 	));
 }
@@ -178,7 +167,6 @@ VRT_priv_top(VRT_CTX, const void *vmod_id)
 
 	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
 	if (ctx->req == NULL) {
-		/* XXX: should we VRT_fail here instead? */
 		WRONG("PRIV_TOP is only accessible in client VCL context");
 		NEEDLESS(return (NULL));
 	}
@@ -187,7 +175,6 @@ VRT_priv_top(VRT_CTX, const void *vmod_id)
 	return (vrt_priv_dynamic(
 	    req->ws,
 	    req->privs,
-	    (uintptr_t)&req->topreq,
 	    (uintptr_t)vmod_id
 	));
 }


More information about the varnish-commit mailing list