[4.1] bf7fb97 Be consistent wrt vsl_ts locking

PÃ¥l Hermunn Johansen hermunn at varnish-software.com
Fri Sep 9 13:01:04 CEST 2016


commit bf7fb977c7df37c2ae7f4aac79afacc11b9c1124
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Mon Aug 8 14:37:04 2016 +0200

    Be consistent wrt vsl_ts locking
    
    Fix an issue where the new timestamp was set without locking.
    
    Spotted by: Coverity

diff --git a/bin/varnishhist/varnishhist.c b/bin/varnishhist/varnishhist.c
index f724bc7..ea72614 100644
--- a/bin/varnishhist/varnishhist.c
+++ b/bin/varnishhist/varnishhist.c
@@ -290,12 +290,6 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[],
 		if (skip || !match)
 			continue;
 
-		/*
-		 * only parse the last tsp seen in this transaction -
-		 * it should be the latest.
-		 */
-		upd_vsl_ts(tsp);
-
 		/* select bucket */
 		i = HIST_RES * (log(value) / log_ten);
 		if (i < hist_low * HIST_RES)
@@ -308,6 +302,12 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[],
 
 		pthread_mutex_lock(&mtx);
 
+		/*
+		 * only parse the last tsp seen in this transaction -
+		 * it should be the latest.
+		 */
+		upd_vsl_ts(tsp);
+
 		/* phase out old data */
 		if (nhist == HIST_N) {
 			u = rr_hist[next_hist];



More information about the varnish-commit mailing list