[master] 07b079a71 Polish: Move heritage.proc_vsmw initialization a bit

Nils Goroll nils.goroll at uplex.de
Mon Jul 3 10:48:06 UTC 2023


commit 07b079a71887c5497166650140bfe7cd3c742f44
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Jul 3 12:29:00 2023 +0200

    Polish: Move heritage.proc_vsmw initialization a bit
    
    printf debugging showed that the initial VSMW_New() call did not go
    through vsm_vsmw_lock() / vsm_vsmw_unlock() simply because the
    function pointers were not initialized yet.
    
    This patch moves the init just after their initialization.
    
    child_main() was previously called right after VSMW_New(), and
    VSM_Init() is almost the first thing which child_main() calls, so
    this move is mostly cosmetic.
    
    Seen staring at #3948

diff --git a/bin/varnishd/cache/cache_shmlog.c b/bin/varnishd/cache/cache_shmlog.c
index fd47d6bfa..e1ae6e286 100644
--- a/bin/varnishd/cache/cache_shmlog.c
+++ b/bin/varnishd/cache/cache_shmlog.c
@@ -662,6 +662,9 @@ VSM_Init(void)
 	vsmw_lock = vsm_vsmw_lock;
 	vsmw_unlock = vsm_vsmw_unlock;
 
+	heritage.proc_vsmw = VSMW_New(heritage.vsm_fd, 0640, "_.index");
+	AN(heritage.proc_vsmw);
+
 	VSC_C_main = VSC_main_New(NULL, NULL, "");
 	AN(VSC_C_main);
 
diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c
index 53918825b..742525fa5 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -402,9 +402,6 @@ mgt_launch_child(struct cli *cli)
 
 		VJ_subproc(JAIL_SUBPROC_WORKER);
 
-		heritage.proc_vsmw = VSMW_New(heritage.vsm_fd, 0640, "_.index");
-		AN(heritage.proc_vsmw);
-
 		/*
 		 * We pass these two params because child_main needs them
 		 * well before it has found its own param struct.


More information about the varnish-commit mailing list