MEDIUM: http: Use the new _HA_ATOMIC_* macros.

Use the new _HA_ATOMIC_* macros and add barriers where needed.
diff --git a/src/http_act.c b/src/http_act.c
index 0346be0..c8618ea 100644
--- a/src/http_act.c
+++ b/src/http_act.c
@@ -192,10 +192,10 @@
 	s->req.analysers = 0;
 	s->res.analysers = 0;
 
-	HA_ATOMIC_ADD(&s->be->be_counters.denied_req, 1);
-	HA_ATOMIC_ADD(&sess->fe->fe_counters.denied_req, 1);
+	_HA_ATOMIC_ADD(&s->be->be_counters.denied_req, 1);
+	_HA_ATOMIC_ADD(&sess->fe->fe_counters.denied_req, 1);
 	if (sess->listener && sess->listener->counters)
-		HA_ATOMIC_ADD(&sess->listener->counters->denied_req, 1);
+		_HA_ATOMIC_ADD(&sess->listener->counters->denied_req, 1);
 
 	if (!(s->flags & SF_ERR_MASK))
 		s->flags |= SF_ERR_PRXCOND;
diff --git a/src/proto_http.c b/src/proto_http.c
index 245fa98..4361d6d 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -721,9 +721,9 @@
 			req->analysers &= AN_REQ_FLT_END;
 			stream_inc_http_req_ctr(s);
 			proxy_inc_fe_req_ctr(sess->fe);
-			HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
+			_HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
 			if (sess->listener->counters)
-				HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
+				_HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
 
 			if (!(s->flags & SF_FINST_MASK))
 				s->flags |= SF_FINST_R;
@@ -754,9 +754,9 @@
 
 			stream_inc_http_req_ctr(s);
 			proxy_inc_fe_req_ctr(sess->fe);
-			HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
+			_HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
 			if (sess->listener->counters)
-				HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
+				_HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
 
 			if (!(s->flags & SF_FINST_MASK))
 				s->flags |= SF_FINST_R;
@@ -784,9 +784,9 @@
 			stream_inc_http_err_ctr(s);
 			stream_inc_http_req_ctr(s);
 			proxy_inc_fe_req_ctr(sess->fe);
-			HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
+			_HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
 			if (sess->listener->counters)
-				HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
+				_HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
 
 			if (!(s->flags & SF_FINST_MASK))
 				s->flags |= SF_FINST_R;
@@ -899,7 +899,7 @@
 		struct acl_cond *cond;
 
 		s->flags |= SF_MONITOR;
-		HA_ATOMIC_ADD(&sess->fe->fe_counters.intercepted_req, 1);
+		_HA_ATOMIC_ADD(&sess->fe->fe_counters.intercepted_req, 1);
 
 		/* Check if we want to fail this monitor request or not */
 		list_for_each_entry(cond, &sess->fe->mon_fail_cond, list) {
@@ -1178,9 +1178,9 @@
 	txn->status = 400;
 	http_reply_and_close(s, txn->status, http_error_message(s));
 
-	HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
+	_HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
 	if (sess->listener->counters)
-		HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
+		_HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
 
  return_prx_cond:
 	if (!(s->flags & SF_ERR_MASK))
@@ -1631,11 +1631,11 @@
 						 replace->area, s->uniq_id);
 				}
 
-				HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_rewrites, 1);
+				_HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_rewrites, 1);
 				if (sess->fe != s->be)
-					HA_ATOMIC_ADD(&s->be->be_counters.failed_rewrites, 1);
+					_HA_ATOMIC_ADD(&s->be->be_counters.failed_rewrites, 1);
 				if (sess->listener->counters)
-					HA_ATOMIC_ADD(&sess->listener->counters->failed_rewrites, 1);
+					_HA_ATOMIC_ADD(&sess->listener->counters->failed_rewrites, 1);
 			}
 
 			free_trash_chunk(replace);
@@ -1983,13 +1983,13 @@
 						 replace->area, s->uniq_id);
 				}
 
-				HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_rewrites, 1);
+				_HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_rewrites, 1);
 				if (sess->fe != s->be)
-					HA_ATOMIC_ADD(&s->be->be_counters.failed_rewrites, 1);
+					_HA_ATOMIC_ADD(&s->be->be_counters.failed_rewrites, 1);
 				if (sess->listener->counters)
-					HA_ATOMIC_ADD(&sess->listener->counters->failed_rewrites, 1);
+					_HA_ATOMIC_ADD(&sess->listener->counters->failed_rewrites, 1);
 				if (objt_server(s->target))
-					HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_rewrites, 1);
+					_HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_rewrites, 1);
 			}
 
 			free_trash_chunk(replace);
@@ -2634,7 +2634,7 @@
 	    unlikely(objt_applet(s->target) == &http_cache_applet)) {
 		/* process the stats request now */
 		if (sess->fe == s->be) /* report it if the request was intercepted by the frontend */
-			HA_ATOMIC_ADD(&sess->fe->fe_counters.intercepted_req, 1);
+			_HA_ATOMIC_ADD(&sess->fe->fe_counters.intercepted_req, 1);
 
 		if (!(s->flags & SF_ERR_MASK))      // this is not really an error but it is
 			s->flags |= SF_ERR_LOCAL;   // to mark that it comes from the proxy
@@ -2708,11 +2708,11 @@
 	if (!req->analyse_exp)
 		req->analyse_exp = tick_add(now_ms, 0);
 	stream_inc_http_err_ctr(s);
-	HA_ATOMIC_ADD(&sess->fe->fe_counters.denied_req, 1);
+	_HA_ATOMIC_ADD(&sess->fe->fe_counters.denied_req, 1);
 	if (sess->fe != s->be)
-		HA_ATOMIC_ADD(&s->be->be_counters.denied_req, 1);
+		_HA_ATOMIC_ADD(&s->be->be_counters.denied_req, 1);
 	if (sess->listener->counters)
-		HA_ATOMIC_ADD(&sess->listener->counters->denied_req, 1);
+		_HA_ATOMIC_ADD(&sess->listener->counters->denied_req, 1);
 	goto done_without_exp;
 
  deny:	/* this request was blocked (denied) */
@@ -2727,11 +2727,11 @@
 	s->logs.tv_request = now;
 	http_reply_and_close(s, txn->status, http_error_message(s));
 	stream_inc_http_err_ctr(s);
-	HA_ATOMIC_ADD(&sess->fe->fe_counters.denied_req, 1);
+	_HA_ATOMIC_ADD(&sess->fe->fe_counters.denied_req, 1);
 	if (sess->fe != s->be)
-		HA_ATOMIC_ADD(&s->be->be_counters.denied_req, 1);
+		_HA_ATOMIC_ADD(&s->be->be_counters.denied_req, 1);
 	if (sess->listener->counters)
-		HA_ATOMIC_ADD(&sess->listener->counters->denied_req, 1);
+		_HA_ATOMIC_ADD(&sess->listener->counters->denied_req, 1);
 	goto return_prx_cond;
 
  return_bad_req:
@@ -2748,9 +2748,9 @@
 	txn->status = 400;
 	http_reply_and_close(s, txn->status, http_error_message(s));
 
-	HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
+	_HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
 	if (sess->listener->counters)
-		HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
+		_HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
 
  return_prx_cond:
 	if (!(s->flags & SF_ERR_MASK))
@@ -3095,9 +3095,9 @@
 	req->analysers &= AN_REQ_FLT_END;
 	http_reply_and_close(s, txn->status, http_error_message(s));
 
-	HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
+	_HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
 	if (sess->listener->counters)
-		HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
+		_HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
 
 	if (!(s->flags & SF_ERR_MASK))
 		s->flags |= SF_ERR_PRXCOND;
@@ -3307,9 +3307,9 @@
 
  return_err_msg:
 	req->analysers &= AN_REQ_FLT_END;
-	HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
+	_HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
 	if (sess->listener->counters)
-		HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
+		_HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
 	return 0;
 }
 
@@ -3404,7 +3404,7 @@
 	}
 
 	if (s->flags & SF_BE_ASSIGNED) {
-		HA_ATOMIC_SUB(&be->beconn, 1);
+		_HA_ATOMIC_SUB(&be->beconn, 1);
 		if (unlikely(s->srv_conn))
 			sess_change_server(s, NULL);
 	}
@@ -3420,12 +3420,12 @@
 			n = 0;
 
 		if (fe->mode == PR_MODE_HTTP) {
-			HA_ATOMIC_ADD(&fe->fe_counters.p.http.rsp[n], 1);
+			_HA_ATOMIC_ADD(&fe->fe_counters.p.http.rsp[n], 1);
 		}
 		if ((s->flags & SF_BE_ASSIGNED) &&
 		    (be->mode == PR_MODE_HTTP)) {
-			HA_ATOMIC_ADD(&be->be_counters.p.http.rsp[n], 1);
-			HA_ATOMIC_ADD(&be->be_counters.p.http.cum_req, 1);
+			_HA_ATOMIC_ADD(&be->be_counters.p.http.rsp[n], 1);
+			_HA_ATOMIC_ADD(&be->be_counters.p.http.cum_req, 1);
 		}
 	}
 
@@ -3471,7 +3471,7 @@
 	if (objt_server(s->target)) {
 		if (s->flags & SF_CURR_SESS) {
 			s->flags &= ~SF_CURR_SESS;
-			HA_ATOMIC_SUB(&__objt_server(s->target)->cur_sess, 1);
+			_HA_ATOMIC_SUB(&__objt_server(s->target)->cur_sess, 1);
 		}
 		if (may_dequeue_tasks(objt_server(s->target), be))
 			process_srv_queue(objt_server(s->target));
@@ -3822,9 +3822,9 @@
 		else if (chn->flags & CF_SHUTW) {
 			txn->rsp.err_state = txn->rsp.msg_state;
 			txn->rsp.msg_state = HTTP_MSG_ERROR;
-			HA_ATOMIC_ADD(&s->be->be_counters.cli_aborts, 1);
+			_HA_ATOMIC_ADD(&s->be->be_counters.cli_aborts, 1);
 			if (objt_server(s->target))
-				HA_ATOMIC_ADD(&objt_server(s->target)->counters.cli_aborts, 1);
+				_HA_ATOMIC_ADD(&objt_server(s->target)->counters.cli_aborts, 1);
 		}
 		goto wait_other_side;
 	}
@@ -4101,10 +4101,10 @@
 				s->flags |= SF_FINST_D;
 		}
 
-		HA_ATOMIC_ADD(&sess->fe->fe_counters.cli_aborts, 1);
-		HA_ATOMIC_ADD(&s->be->be_counters.cli_aborts, 1);
+		_HA_ATOMIC_ADD(&sess->fe->fe_counters.cli_aborts, 1);
+		_HA_ATOMIC_ADD(&s->be->be_counters.cli_aborts, 1);
 		if (objt_server(s->target))
-			HA_ATOMIC_ADD(&objt_server(s->target)->counters.cli_aborts, 1);
+			_HA_ATOMIC_ADD(&objt_server(s->target)->counters.cli_aborts, 1);
 
 		goto return_bad_req_stats_ok;
 	}
@@ -4139,9 +4139,9 @@
 	return 0;
 
  return_bad_req: /* let's centralize all bad requests */
-	HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
+	_HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
 	if (sess->listener->counters)
-		HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
+		_HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
 
  return_bad_req_stats_ok:
 	txn->req.err_state = txn->req.msg_state;
@@ -4179,10 +4179,10 @@
 	req->analysers   &= AN_REQ_FLT_END;
 	s->res.analysers &= AN_RES_FLT_END; /* we're in data phase, we want to abort both directions */
 
-	HA_ATOMIC_ADD(&sess->fe->fe_counters.srv_aborts, 1);
-	HA_ATOMIC_ADD(&s->be->be_counters.srv_aborts, 1);
+	_HA_ATOMIC_ADD(&sess->fe->fe_counters.srv_aborts, 1);
+	_HA_ATOMIC_ADD(&s->be->be_counters.srv_aborts, 1);
 	if (objt_server(s->target))
-		HA_ATOMIC_ADD(&objt_server(s->target)->counters.srv_aborts, 1);
+		_HA_ATOMIC_ADD(&objt_server(s->target)->counters.srv_aborts, 1);
 
 	if (!(s->flags & SF_ERR_MASK))
 		s->flags |= SF_ERR_SRVCL;
@@ -4312,9 +4312,9 @@
 			if (msg->msg_state == HTTP_MSG_ERROR || msg->err_pos >= 0)
 				http_capture_bad_message(s->be, s, msg, msg->err_state, sess->fe);
 
-			HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
+			_HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
 			if (objt_server(s->target)) {
-				HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
+				_HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
 				health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_HDRRSP);
 			}
 		abort_response:
@@ -4347,9 +4347,9 @@
 			else if (txn->flags & TX_NOT_FIRST)
 				goto abort_keep_alive;
 
-			HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
+			_HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
 			if (objt_server(s->target)) {
-				HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
+				_HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
 				health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_READ_ERROR);
 			}
 
@@ -4383,9 +4383,9 @@
 			if (msg->err_pos >= 0)
 				http_capture_bad_message(s->be, s, msg, msg->err_state, sess->fe);
 
-			HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
+			_HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
 			if (objt_server(s->target)) {
-				HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
+				_HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
 				health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_READ_TIMEOUT);
 			}
 
@@ -4405,10 +4405,10 @@
 
 		/* client abort with an abortonclose */
 		else if ((rep->flags & CF_SHUTR) && ((s->req.flags & (CF_SHUTR|CF_SHUTW)) == (CF_SHUTR|CF_SHUTW))) {
-			HA_ATOMIC_ADD(&sess->fe->fe_counters.cli_aborts, 1);
-			HA_ATOMIC_ADD(&s->be->be_counters.cli_aborts, 1);
+			_HA_ATOMIC_ADD(&sess->fe->fe_counters.cli_aborts, 1);
+			_HA_ATOMIC_ADD(&s->be->be_counters.cli_aborts, 1);
 			if (objt_server(s->target))
-				HA_ATOMIC_ADD(&objt_server(s->target)->counters.cli_aborts, 1);
+				_HA_ATOMIC_ADD(&objt_server(s->target)->counters.cli_aborts, 1);
 
 			rep->analysers &= AN_RES_FLT_END;
 			channel_auto_close(rep);
@@ -4433,9 +4433,9 @@
 			else if (txn->flags & TX_NOT_FIRST)
 				goto abort_keep_alive;
 
-			HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
+			_HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
 			if (objt_server(s->target)) {
-				HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
+				_HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
 				health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_BROKEN_PIPE);
 			}
 
@@ -4460,7 +4460,7 @@
 			else if (txn->flags & TX_NOT_FIRST)
 				goto abort_keep_alive;
 
-			HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
+			_HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
 			rep->analysers &= AN_RES_FLT_END;
 			channel_auto_close(rep);
 
@@ -4501,7 +4501,7 @@
 		stream_inc_http_err_ctr(s);
 
 	if (objt_server(s->target))
-		HA_ATOMIC_ADD(&objt_server(s->target)->counters.p.http.rsp[n], 1);
+		_HA_ATOMIC_ADD(&objt_server(s->target)->counters.p.http.rsp[n], 1);
 
 	/* RFC7230#2.6 has enforced the format of the HTTP version string to be
 	 * exactly one digit "." one digit. This check may be disabled using
@@ -4935,10 +4935,10 @@
 			if (apply_filters_to_response(s, rep, rule_set) < 0) {
 			return_bad_resp:
 				if (objt_server(s->target)) {
-					HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
+					_HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
 					health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_RSP);
 				}
-				HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
+				_HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
 			return_srv_prx_502:
 				rep->analysers &= AN_RES_FLT_END;
 				txn->status = 502;
@@ -4957,12 +4957,12 @@
 		/* has the response been denied ? */
 		if (txn->flags & TX_SVDENY) {
 			if (objt_server(s->target))
-				HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_secu, 1);
+				_HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_secu, 1);
 
-			HA_ATOMIC_ADD(&s->be->be_counters.denied_resp, 1);
-			HA_ATOMIC_ADD(&sess->fe->fe_counters.denied_resp, 1);
+			_HA_ATOMIC_ADD(&s->be->be_counters.denied_resp, 1);
+			_HA_ATOMIC_ADD(&sess->fe->fe_counters.denied_resp, 1);
 			if (sess->listener->counters)
-				HA_ATOMIC_ADD(&sess->listener->counters->denied_resp, 1);
+				_HA_ATOMIC_ADD(&sess->listener->counters->denied_resp, 1);
 
 			goto return_srv_prx_502;
 		}
@@ -5109,12 +5109,12 @@
 		 * the 'checkcache' option, and send an alert.
 		 */
 		if (objt_server(s->target))
-			HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_secu, 1);
+			_HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_secu, 1);
 
-		HA_ATOMIC_ADD(&s->be->be_counters.denied_resp, 1);
-		HA_ATOMIC_ADD(&sess->fe->fe_counters.denied_resp, 1);
+		_HA_ATOMIC_ADD(&s->be->be_counters.denied_resp, 1);
+		_HA_ATOMIC_ADD(&sess->fe->fe_counters.denied_resp, 1);
 		if (sess->listener->counters)
-			HA_ATOMIC_ADD(&sess->listener->counters->denied_resp, 1);
+			_HA_ATOMIC_ADD(&sess->listener->counters->denied_resp, 1);
 
 		ha_alert("Blocking cacheable cookie in response from instance %s, server %s.\n",
 			 s->be->id, objt_server(s->target) ? objt_server(s->target)->id : "<dispatch>");
@@ -5301,9 +5301,9 @@
 		if (!ci_data(res)) {
 			if (!(s->flags & SF_ERR_MASK))
 				s->flags |= SF_ERR_SRVCL;
-			HA_ATOMIC_ADD(&s->be->be_counters.srv_aborts, 1);
+			_HA_ATOMIC_ADD(&s->be->be_counters.srv_aborts, 1);
 			if (objt_server(s->target))
-				HA_ATOMIC_ADD(&objt_server(s->target)->counters.srv_aborts, 1);
+				_HA_ATOMIC_ADD(&objt_server(s->target)->counters.srv_aborts, 1);
 			goto return_bad_res_stats_ok;
 		}
 	}
@@ -5339,9 +5339,9 @@
 	return 0;
 
  return_bad_res: /* let's centralize all bad responses */
-	HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
+	_HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
 	if (objt_server(s->target))
-		HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_resp, 1);
+		_HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_resp, 1);
 
  return_bad_res_stats_ok:
 	txn->rsp.err_state = txn->rsp.msg_state;
@@ -5367,10 +5367,10 @@
 	res->analysers   &= AN_RES_FLT_END;
 	s->req.analysers &= AN_REQ_FLT_END; /* we're in data phase, we want to abort both directions */
 
-	HA_ATOMIC_ADD(&sess->fe->fe_counters.cli_aborts, 1);
-	HA_ATOMIC_ADD(&s->be->be_counters.cli_aborts, 1);
+	_HA_ATOMIC_ADD(&sess->fe->fe_counters.cli_aborts, 1);
+	_HA_ATOMIC_ADD(&s->be->be_counters.cli_aborts, 1);
 	if (objt_server(s->target))
-		HA_ATOMIC_ADD(&objt_server(s->target)->counters.cli_aborts, 1);
+		_HA_ATOMIC_ADD(&objt_server(s->target)->counters.cli_aborts, 1);
 
 	if (!(s->flags & SF_ERR_MASK))
 		s->flags |= SF_ERR_CLICL;
@@ -7306,7 +7306,7 @@
 	s->target = NULL;
 	/* re-init store persistence */
 	s->store_count = 0;
-	s->uniq_id = HA_ATOMIC_XADD(&global.req_count, 1);
+	s->uniq_id = _HA_ATOMIC_XADD(&global.req_count, 1);
 
 	s->req.flags |= CF_READ_DONTWAIT; /* one read is usually enough */
 
diff --git a/src/proto_htx.c b/src/proto_htx.c
index 9009fa9..255199e 100644
--- a/src/proto_htx.c
+++ b/src/proto_htx.c
@@ -159,9 +159,9 @@
 			stream_inc_http_err_ctr(s);
 			stream_inc_http_req_ctr(s);
 			proxy_inc_fe_req_ctr(sess->fe);
-			HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
+			_HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
 			if (sess->listener->counters)
-				HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
+				_HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
 
 			txn->status = 400;
 			msg->err_state = msg->msg_state;
@@ -188,9 +188,9 @@
 			stream_inc_http_err_ctr(s);
 			stream_inc_http_req_ctr(s);
 			proxy_inc_fe_req_ctr(sess->fe);
-			HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
+			_HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
 			if (sess->listener->counters)
-				HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
+				_HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
 
 			txn->status = 408;
 			msg->err_state = msg->msg_state;
@@ -217,9 +217,9 @@
 			stream_inc_http_err_ctr(s);
 			stream_inc_http_req_ctr(s);
 			proxy_inc_fe_req_ctr(sess->fe);
-			HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
+			_HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
 			if (sess->listener->counters)
-				HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
+				_HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
 
 			txn->status = 400;
 			msg->err_state = msg->msg_state;
@@ -344,7 +344,7 @@
 		struct acl_cond *cond;
 
 		s->flags |= SF_MONITOR;
-		HA_ATOMIC_ADD(&sess->fe->fe_counters.intercepted_req, 1);
+		_HA_ATOMIC_ADD(&sess->fe->fe_counters.intercepted_req, 1);
 
 		/* Check if we want to fail this monitor request or not */
 		list_for_each_entry(cond, &sess->fe->mon_fail_cond, list) {
@@ -457,9 +457,9 @@
 	txn->req.err_state = txn->req.msg_state;
 	txn->req.msg_state = HTTP_MSG_ERROR;
 	htx_reply_and_close(s, txn->status, htx_error_message(s));
-	HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
+	_HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
 	if (sess->listener->counters)
-		HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
+		_HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
 
  return_prx_cond:
 	if (!(s->flags & SF_ERR_MASK))
@@ -616,7 +616,7 @@
 	    unlikely(objt_applet(s->target) == &http_cache_applet)) {
 		/* process the stats request now */
 		if (sess->fe == s->be) /* report it if the request was intercepted by the frontend */
-			HA_ATOMIC_ADD(&sess->fe->fe_counters.intercepted_req, 1);
+			_HA_ATOMIC_ADD(&sess->fe->fe_counters.intercepted_req, 1);
 
 		if (!(s->flags & SF_ERR_MASK))      // this is not really an error but it is
 			s->flags |= SF_ERR_LOCAL;   // to mark that it comes from the proxy
@@ -690,11 +690,11 @@
 	if (!req->analyse_exp)
 		req->analyse_exp = tick_add(now_ms, 0);
 	stream_inc_http_err_ctr(s);
-	HA_ATOMIC_ADD(&sess->fe->fe_counters.denied_req, 1);
+	_HA_ATOMIC_ADD(&sess->fe->fe_counters.denied_req, 1);
 	if (sess->fe != s->be)
-		HA_ATOMIC_ADD(&s->be->be_counters.denied_req, 1);
+		_HA_ATOMIC_ADD(&s->be->be_counters.denied_req, 1);
 	if (sess->listener->counters)
-		HA_ATOMIC_ADD(&sess->listener->counters->denied_req, 1);
+		_HA_ATOMIC_ADD(&sess->listener->counters->denied_req, 1);
 	goto done_without_exp;
 
  deny:	/* this request was blocked (denied) */
@@ -709,11 +709,11 @@
 	s->logs.tv_request = now;
 	htx_reply_and_close(s, txn->status, htx_error_message(s));
 	stream_inc_http_err_ctr(s);
-	HA_ATOMIC_ADD(&sess->fe->fe_counters.denied_req, 1);
+	_HA_ATOMIC_ADD(&sess->fe->fe_counters.denied_req, 1);
 	if (sess->fe != s->be)
-		HA_ATOMIC_ADD(&s->be->be_counters.denied_req, 1);
+		_HA_ATOMIC_ADD(&s->be->be_counters.denied_req, 1);
 	if (sess->listener->counters)
-		HA_ATOMIC_ADD(&sess->listener->counters->denied_req, 1);
+		_HA_ATOMIC_ADD(&sess->listener->counters->denied_req, 1);
 	goto return_prx_cond;
 
  return_bad_req:
@@ -722,9 +722,9 @@
 	txn->status = 400;
 	htx_reply_and_close(s, txn->status, htx_error_message(s));
 
-	HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
+	_HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
 	if (sess->listener->counters)
-		HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
+		_HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
 
  return_prx_cond:
 	if (!(s->flags & SF_ERR_MASK))
@@ -984,9 +984,9 @@
 	req->analysers &= AN_REQ_FLT_END;
 	htx_reply_and_close(s, txn->status, htx_error_message(s));
 
-	HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
+	_HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
 	if (sess->listener->counters)
-		HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
+		_HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
 
 	if (!(s->flags & SF_ERR_MASK))
 		s->flags |= SF_ERR_PRXCOND;
@@ -1148,9 +1148,9 @@
 
  return_err_msg:
 	req->analysers &= AN_REQ_FLT_END;
-	HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
+	_HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
 	if (sess->listener->counters)
-		HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
+		_HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
 	return 0;
 }
 
@@ -1321,10 +1321,10 @@
 				s->flags |= SF_FINST_D;
 		}
 
-		HA_ATOMIC_ADD(&sess->fe->fe_counters.cli_aborts, 1);
-		HA_ATOMIC_ADD(&s->be->be_counters.cli_aborts, 1);
+		_HA_ATOMIC_ADD(&sess->fe->fe_counters.cli_aborts, 1);
+		_HA_ATOMIC_ADD(&s->be->be_counters.cli_aborts, 1);
 		if (objt_server(s->target))
-			HA_ATOMIC_ADD(&objt_server(s->target)->counters.cli_aborts, 1);
+			_HA_ATOMIC_ADD(&objt_server(s->target)->counters.cli_aborts, 1);
 
 		goto return_bad_req_stats_ok;
 	}
@@ -1362,9 +1362,9 @@
 	return 0;
 
  return_bad_req: /* let's centralize all bad requests */
-	HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
+	_HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
 	if (sess->listener->counters)
-		HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
+		_HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
 
  return_bad_req_stats_ok:
 	txn->req.err_state = txn->req.msg_state;
@@ -1402,10 +1402,10 @@
 	req->analysers   &= AN_REQ_FLT_END;
 	s->res.analysers &= AN_RES_FLT_END; /* we're in data phase, we want to abort both directions */
 
-	HA_ATOMIC_ADD(&sess->fe->fe_counters.srv_aborts, 1);
-	HA_ATOMIC_ADD(&s->be->be_counters.srv_aborts, 1);
+	_HA_ATOMIC_ADD(&sess->fe->fe_counters.srv_aborts, 1);
+	_HA_ATOMIC_ADD(&s->be->be_counters.srv_aborts, 1);
 	if (objt_server(s->target))
-		HA_ATOMIC_ADD(&objt_server(s->target)->counters.srv_aborts, 1);
+		_HA_ATOMIC_ADD(&objt_server(s->target)->counters.srv_aborts, 1);
 
 	if (!(s->flags & SF_ERR_MASK))
 		s->flags |= SF_ERR_SRVCL;
@@ -1485,9 +1485,9 @@
 			if (txn->flags & TX_NOT_FIRST)
 				goto abort_keep_alive;
 
-			HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
+			_HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
 			if (objt_server(s->target)) {
-				HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
+				_HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
 				health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_READ_ERROR);
 			}
 
@@ -1516,9 +1516,9 @@
 
 		/* 2: read timeout : return a 504 to the client. */
 		else if (rep->flags & CF_READ_TIMEOUT) {
-			HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
+			_HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
 			if (objt_server(s->target)) {
-				HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
+				_HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
 				health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_READ_TIMEOUT);
 			}
 
@@ -1536,10 +1536,10 @@
 
 		/* 3: client abort with an abortonclose */
 		else if ((rep->flags & CF_SHUTR) && ((s->req.flags & (CF_SHUTR|CF_SHUTW)) == (CF_SHUTR|CF_SHUTW))) {
-			HA_ATOMIC_ADD(&sess->fe->fe_counters.cli_aborts, 1);
-			HA_ATOMIC_ADD(&s->be->be_counters.cli_aborts, 1);
+			_HA_ATOMIC_ADD(&sess->fe->fe_counters.cli_aborts, 1);
+			_HA_ATOMIC_ADD(&s->be->be_counters.cli_aborts, 1);
 			if (objt_server(s->target))
-				HA_ATOMIC_ADD(&__objt_server(s->target)->counters.cli_aborts, 1);
+				_HA_ATOMIC_ADD(&__objt_server(s->target)->counters.cli_aborts, 1);
 
 			rep->analysers &= AN_RES_FLT_END;
 			txn->status = 400;
@@ -1559,9 +1559,9 @@
 			if (txn->flags & TX_NOT_FIRST)
 				goto abort_keep_alive;
 
-			HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
+			_HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
 			if (objt_server(s->target)) {
-				HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
+				_HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
 				health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_BROKEN_PIPE);
 			}
 
@@ -1582,7 +1582,7 @@
 			if (txn->flags & TX_NOT_FIRST)
 				goto abort_keep_alive;
 
-			HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
+			_HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
 			rep->analysers &= AN_RES_FLT_END;
 
 			if (!(s->flags & SF_ERR_MASK))
@@ -1653,7 +1653,7 @@
 		stream_inc_http_err_ctr(s);
 
 	if (objt_server(s->target))
-		HA_ATOMIC_ADD(&__objt_server(s->target)->counters.p.http.rsp[n], 1);
+		_HA_ATOMIC_ADD(&__objt_server(s->target)->counters.p.http.rsp[n], 1);
 
 	/* Adjust server's health based on status code. Note: status codes 501
 	 * and 505 are triggered on demand by client request, so we must not
@@ -1771,9 +1771,9 @@
 	return 1;
 
  return_bad_res:
-	HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
+	_HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
 	if (objt_server(s->target)) {
-		HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
+		_HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
 		health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_HDRRSP);
 	}
 	txn->status = 502;
@@ -1894,12 +1894,12 @@
 		/* has the response been denied ? */
 		if (txn->flags & TX_SVDENY) {
 			if (objt_server(s->target))
-				HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_secu, 1);
+				_HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_secu, 1);
 
-			HA_ATOMIC_ADD(&s->be->be_counters.denied_resp, 1);
-			HA_ATOMIC_ADD(&sess->fe->fe_counters.denied_resp, 1);
+			_HA_ATOMIC_ADD(&s->be->be_counters.denied_resp, 1);
+			_HA_ATOMIC_ADD(&sess->fe->fe_counters.denied_resp, 1);
 			if (sess->listener->counters)
-				HA_ATOMIC_ADD(&sess->listener->counters->denied_resp, 1);
+				_HA_ATOMIC_ADD(&sess->listener->counters->denied_resp, 1);
 			goto return_srv_prx_502;
 		}
 
@@ -2047,12 +2047,12 @@
 		 * the 'checkcache' option, and send an alert.
 		 */
 		if (objt_server(s->target))
-			HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_secu, 1);
+			_HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_secu, 1);
 
-		HA_ATOMIC_ADD(&s->be->be_counters.denied_resp, 1);
-		HA_ATOMIC_ADD(&sess->fe->fe_counters.denied_resp, 1);
+		_HA_ATOMIC_ADD(&s->be->be_counters.denied_resp, 1);
+		_HA_ATOMIC_ADD(&sess->fe->fe_counters.denied_resp, 1);
 		if (sess->listener->counters)
-			HA_ATOMIC_ADD(&sess->listener->counters->denied_resp, 1);
+			_HA_ATOMIC_ADD(&sess->listener->counters->denied_resp, 1);
 
 		ha_alert("Blocking cacheable cookie in response from instance %s, server %s.\n",
 			 s->be->id, objt_server(s->target) ? objt_server(s->target)->id : "<dispatch>");
@@ -2081,10 +2081,10 @@
 
   return_bad_resp:
 	if (objt_server(s->target)) {
-		HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
+		_HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
 		health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_RSP);
 	}
-	HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
+	_HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
 
   return_srv_prx_502:
 	rep->analysers &= AN_RES_FLT_END;
@@ -2261,9 +2261,9 @@
 		if (htx_is_empty(htx)) {
 			if (!(s->flags & SF_ERR_MASK))
 				s->flags |= SF_ERR_SRVCL;
-			HA_ATOMIC_ADD(&s->be->be_counters.srv_aborts, 1);
+			_HA_ATOMIC_ADD(&s->be->be_counters.srv_aborts, 1);
 			if (objt_server(s->target))
-				HA_ATOMIC_ADD(&objt_server(s->target)->counters.srv_aborts, 1);
+				_HA_ATOMIC_ADD(&objt_server(s->target)->counters.srv_aborts, 1);
 			goto return_bad_res_stats_ok;
 		}
 	}
@@ -2292,9 +2292,9 @@
 	return 0;
 
  return_bad_res: /* let's centralize all bad responses */
-	HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
+	_HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
 	if (objt_server(s->target))
-		HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_resp, 1);
+		_HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_resp, 1);
 
  return_bad_res_stats_ok:
 	txn->rsp.err_state = txn->rsp.msg_state;
@@ -2320,10 +2320,10 @@
 	res->analysers   &= AN_RES_FLT_END;
 	s->req.analysers &= AN_REQ_FLT_END; /* we're in data phase, we want to abort both directions */
 
-	HA_ATOMIC_ADD(&sess->fe->fe_counters.cli_aborts, 1);
-	HA_ATOMIC_ADD(&s->be->be_counters.cli_aborts, 1);
+	_HA_ATOMIC_ADD(&sess->fe->fe_counters.cli_aborts, 1);
+	_HA_ATOMIC_ADD(&s->be->be_counters.cli_aborts, 1);
 	if (objt_server(s->target))
-		HA_ATOMIC_ADD(&objt_server(s->target)->counters.cli_aborts, 1);
+		_HA_ATOMIC_ADD(&objt_server(s->target)->counters.cli_aborts, 1);
 
 	if (!(s->flags & SF_ERR_MASK))
 		s->flags |= SF_ERR_CLICL;
@@ -2924,11 +2924,11 @@
 						send_log(px, LOG_WARNING, "Proxy %s failed to add or set the request header '%.*s' for request #%u. You might need to increase tune.maxrewrite.", px->id, (int)n.len, n.ptr, s->uniq_id);
 					}
 
-					HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_rewrites, 1);
+					_HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_rewrites, 1);
 					if (sess->fe != s->be)
-						HA_ATOMIC_ADD(&s->be->be_counters.failed_rewrites, 1);
+						_HA_ATOMIC_ADD(&s->be->be_counters.failed_rewrites, 1);
 					if (sess->listener->counters)
-						HA_ATOMIC_ADD(&sess->listener->counters->failed_rewrites, 1);
+						_HA_ATOMIC_ADD(&sess->listener->counters->failed_rewrites, 1);
 				}
 				free_trash_chunk(replace);
 				break;
@@ -3260,13 +3260,13 @@
 						send_log(px, LOG_WARNING, "Proxy %s failed to add or set the response header '%.*s' for request #%u. You might need to increase tune.maxrewrite.", px->id, (int)n.len, n.ptr, s->uniq_id);
 					}
 
-					HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_rewrites, 1);
+					_HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_rewrites, 1);
 					if (sess->fe != s->be)
-						HA_ATOMIC_ADD(&s->be->be_counters.failed_rewrites, 1);
+						_HA_ATOMIC_ADD(&s->be->be_counters.failed_rewrites, 1);
 					if (sess->listener->counters)
-						HA_ATOMIC_ADD(&sess->listener->counters->failed_rewrites, 1);
+						_HA_ATOMIC_ADD(&sess->listener->counters->failed_rewrites, 1);
 					if (objt_server(s->target))
-						HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_rewrites, 1);
+						_HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_rewrites, 1);
 				}
 				free_trash_chunk(replace);
 				break;
@@ -5278,9 +5278,9 @@
 		else if (chn->flags & CF_SHUTW) {
 			txn->rsp.err_state = txn->rsp.msg_state;
 			txn->rsp.msg_state = HTTP_MSG_ERROR;
-			HA_ATOMIC_ADD(&s->be->be_counters.cli_aborts, 1);
+			_HA_ATOMIC_ADD(&s->be->be_counters.cli_aborts, 1);
 			if (objt_server(s->target))
-				HA_ATOMIC_ADD(&objt_server(s->target)->counters.cli_aborts, 1);
+				_HA_ATOMIC_ADD(&objt_server(s->target)->counters.cli_aborts, 1);
 			goto end;
 		}
 		return;