[master] 9d1bc0d Be consistent wrt vsl_ts locking

Martin Blix Grydeland martin at varnish-software.com
Mon Aug 8 15:04:09 CEST 2016


commit 9d1bc0d62fdc11331ecfa420a9001454fd1b8c08
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 e214117..b8de56f 100644
--- a/bin/varnishhist/varnishhist.c
+++ b/bin/varnishhist/varnishhist.c
@@ -291,12 +291,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)
@@ -309,6 +303,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