r4275 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Sun Oct 4 14:46:42 CEST 2009


Author: phk
Date: 2009-10-04 14:46:42 +0200 (Sun, 04 Oct 2009)
New Revision: 4275

Modified:
   trunk/varnish-cache/bin/varnishd/storage_persistent.c
Log:
Add another band-aid suicide clause when we run out of space in the silo.



Modified: trunk/varnish-cache/bin/varnishd/storage_persistent.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/storage_persistent.c	2009-10-04 12:38:52 UTC (rev 4274)
+++ trunk/varnish-cache/bin/varnishd/storage_persistent.c	2009-10-04 12:46:42 UTC (rev 4275)
@@ -46,6 +46,7 @@
 #include <sys/param.h>
 #include <sys/mman.h>
 
+#include "shmlog.h"
 #include "cache.h"
 #include "stevedore.h"
 #include "hash_slinger.h"
@@ -1063,7 +1064,18 @@
 	sg->length = sc->aim_segl;
 	sg->length &= ~7;
 
+	if (sg->offset + sg->length > sc->mediasize) {
+		sc->free_offset = sc->ident->stuff[SMP_SPC_STUFF];
+		sg->offset = sc->free_offset;
+		sg2 = VTAILQ_FIRST(&sc->segments);
+		if (sg->offset + sg->length > sg2->offset) {
+			printf("Out of space in persistent silo\n");
+			printf("Committing suicide, restart will make space\n");
+			exit (0);
+		}
+	}
 
+
 	assert(sg->offset + sg->length <= sc->mediasize);
 
 	sg2 = VTAILQ_FIRST(&sc->segments);



More information about the varnish-commit mailing list