[master] 69e6872 Add a per session mutex, there are now things we do in parallel which will need this.

Poul-Henning Kamp phk at varnish-cache.org
Mon Jul 8 11:50:53 CEST 2013


commit 69e6872bd2ae020196258f0ff78b3f9d748ab60b
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jul 8 09:49:50 2013 +0000

    Add a per session mutex, there are now things we do in parallel
    which will need this.
    
    We may need to improve MPL or LCK to cope with this.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index fbf0989..b673eb1 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -709,6 +709,7 @@ struct sess {
 #define SESS_MAGIC		0x2c2f9c5a
 
 	enum sess_step		sess_step;
+	struct lock		mtx;
 	int			fd;
 	enum sess_close		reason;
 	uint32_t		vxid;
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index f117459..8d80160 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -102,6 +102,7 @@ ses_setup(struct sess *sp)
 	sp->sockaddr.ss_family = sp->mysockaddr.ss_family = PF_UNSPEC;
 	sp->t_open = NAN;
 	sp->t_idle = NAN;
+	Lck_New(&sp->mtx, lck_sess);
 }
 
 /*--------------------------------------------------------------------
@@ -332,6 +333,7 @@ SES_Delete(struct sess *sp, enum sess_close reason, double now)
 	    b->pipe, b->pass, b->fetch, b->hdrbytes, b->bodybytes);
 	VSL(SLT_End, sp->vxid, "%s", "");
 
+	Lck_Delete(&sp->mtx);
 	MPL_Free(pp->mpl_sess, sp);
 }
 
diff --git a/include/tbl/locks.h b/include/tbl/locks.h
index 68077ce..8329bab 100644
--- a/include/tbl/locks.h
+++ b/include/tbl/locks.h
@@ -37,6 +37,7 @@ LOCK(hcb)
 LOCK(hcl)
 LOCK(vcl)
 LOCK(sessmem)
+LOCK(sess)
 LOCK(wstat)
 LOCK(herder)
 LOCK(wq)



More information about the varnish-commit mailing list