r3856 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Mon Mar 2 14:39:09 CET 2009


Author: phk
Date: 2009-03-02 14:39:09 +0100 (Mon, 02 Mar 2009)
New Revision: 3856

Modified:
   trunk/varnish-cache/bin/varnishd/cache_center.c
Log:
Cache the vcl_fetch{} result, in case vcl_discard{} (via LRU) overwrites
it during body fetch.



Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c	2009-03-02 12:56:03 UTC (rev 3855)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c	2009-03-02 13:39:09 UTC (rev 3856)
@@ -380,6 +380,7 @@
 	struct http *hp, *hp2;
 	struct object *o;
 	char *b;
+	unsigned handling;
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC);
@@ -442,8 +443,15 @@
 
 	VCL_fetch_method(sp);
 
-	o = HSH_NewObject(sp, sp->handling != VCL_RET_DELIVER);
+	/*
+	 * When we fetch the body, we may hit the LRU cleanup and that
+	 * will overwrite sp->handling, so we have to save our plans
+	 * here.
+	 */
+	handling = sp->handling;
 
+	o = HSH_NewObject(sp, handling != VCL_RET_DELIVER);
+
 	if (sp->objhead != NULL) {
 		CHECK_OBJ_NOTNULL(sp->objhead, OBJHEAD_MAGIC);
 		CHECK_OBJ_NOTNULL(sp->objcore, OBJCORE_MAGIC);
@@ -498,7 +506,7 @@
 
 	VBE_free_bereq(&sp->bereq);
 
-	switch (sp->handling) {
+	switch (handling) {
 	case VCL_RET_RESTART:
 		HSH_Drop(sp);
 		sp->director = NULL;



More information about the varnish-commit mailing list