From: phk Date: Sun, 24 Jun 2007 09:40:09 +0000 (+0000) Subject: Make sure we cache a consistent view of the workspace size. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e72e68c91ca0fa5f21b68acb4da4727397c1776;p=varnish 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 --- 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);