From 3e72e68c91ca0fa5f21b68acb4da4727397c1776 Mon Sep 17 00:00:00 2001 From: phk Date: Sun, 24 Jun 2007 09:40:09 +0000 Subject: [PATCH] Make sure we cache a consistent view of the workspace size. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1537 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_session.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache_session.c b/varnish-cache/bin/varnishd/cache_session.c index 96f871ea..2ca9efbf 100644 --- a/varnish-cache/bin/varnishd/cache_session.c +++ b/varnish-cache/bin/varnishd/cache_session.c @@ -255,8 +255,7 @@ struct sess * SES_New(struct sockaddr *addr, unsigned len) { struct sessmem *sm; - unsigned u; - + volatile unsigned u; /* * One of the two queues is unlocked because only one @@ -279,6 +278,10 @@ SES_New(struct sockaddr *addr, unsigned len) } else { /* * If that fails, alloc new one. + * + * It is not necessary to lock mem_workspace, but we + * need to cache it locally, to make sure we get a + * consistent view of it. */ u = params->mem_workspace; sm = malloc(sizeof *sm + u); -- 2.39.5