[9.18] Detach the zone views outside of the zone lock
requested to merge 3801-reduce-memory-bloat-caused-by-delayed-view-detach-lock-order-inversion-v9_18 into v9_18
Detaching the views in the zone_shutdown() could lead to lock-order-inversion between adb->namelocks[bucket], adb->lock, view->lock and zone->lock. Detach the views outside of the section that zone-locked.
(cherry picked from commit 978a0ef8)
Closes #3801 (closed)
Backport of MR !7402 (merged)
Edited by Ondřej Surý