diff --git a/src/dns.c b/src/dns.c index 63bb52f25..baafe844f 100644 --- a/src/dns.c +++ b/src/dns.c @@ -775,6 +775,14 @@ static void dns_session_release(struct appctx *appctx) if (!ds) return; + /* We do not call ring_appctx_detach here + * because we want to keep readers counters + * to retry a conn with a different appctx. + */ + HA_RWLOCK_WRLOCK(DNS_LOCK, &ds->ring.lock); + LIST_DEL_INIT(&appctx->wait_entry); + HA_RWLOCK_WRUNLOCK(DNS_LOCK, &ds->ring.lock); + dss = ds->dss; HA_SPIN_LOCK(DNS_LOCK, &dss->lock); @@ -808,13 +816,6 @@ static void dns_session_release(struct appctx *appctx) return; } - /* We do not call ring_appctx_detach here - * because we want to keep readers counters - * to retry a con with a different appctx*/ - HA_RWLOCK_WRLOCK(DNS_LOCK, &ds->ring.lock); - LIST_DEL_INIT(&appctx->wait_entry); - HA_RWLOCK_WRUNLOCK(DNS_LOCK, &ds->ring.lock); - /* if there is no pending complete response * message, ensure to reset * message offsets if the session