r3667 - branches/2.0/varnish-cache/bin/varnishd

tfheen at projects.linpro.no tfheen at projects.linpro.no
Fri Feb 6 14:25:03 CET 2009


Author: tfheen
Date: 2009-02-06 14:25:02 +0100 (Fri, 06 Feb 2009)
New Revision: 3667

Modified:
   branches/2.0/varnish-cache/bin/varnishd/storage_file.c
Log:
Merge r3474: Assert lock properly held, inspired by unease about #378.



Modified: branches/2.0/varnish-cache/bin/varnishd/storage_file.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/storage_file.c	2009-02-06 13:22:01 UTC (rev 3666)
+++ branches/2.0/varnish-cache/bin/varnishd/storage_file.c	2009-02-06 13:25:02 UTC (rev 3667)
@@ -343,6 +343,7 @@
 
 	assert(sp->alloc == 0);
 	assert(sp->flist == NULL);
+	Lck_AssertHeld(&sc->mtx);
 	b = sp->size / sc->pagesize;
 	if (b >= NBUCKET) {
 		b = NBUCKET - 1;
@@ -372,6 +373,7 @@
 
 	assert(sp->alloc == 0);
 	assert(sp->flist != NULL);
+	Lck_AssertHeld(&sc->mtx);
 	b = sp->size / sc->pagesize;
 	if (b >= NBUCKET) {
 		b = NBUCKET - 1;
@@ -602,14 +604,16 @@
 
 	sc = st->priv;
 
+	Lck_New(&sc->mtx);
+	Lck_Lock(&sc->mtx);
 	smf_open_chunk(sc, sc->filesize, 0, &fail, &sum);
+	Lck_Unlock(&sc->mtx);
 	printf("managed to mmap %ju bytes of %ju\n",
 	    (uintmax_t)sum, sc->filesize);
 
 	/* XXX */
 	if (sum < MINPAGES * (off_t)getpagesize())
 		exit (2);
-	Lck_New(&sc->mtx);
 
 	VSL_stats->sm_bfree += sc->filesize;
 }



More information about the varnish-commit mailing list