Commit 308bc46a introduced a change to the view_flushanddetach() function which makes the latter access view->zonetable without holding view->lock. As confirmed by TSAN, this enables races between threads for view->zonetable accesses. Reverting the offending change doesn't work, because then there's lock-ordering problem.
The MR splits the
dns_zt_detachandflush() into two parts, cleans up
view->zonetable locked and detaches the swapped zt pointer unlocked.
Closes #2979 (closed)